adding remove-view-attr, which is necessary for things like checkboxes.
This commit is contained in:
parent
b9d20d174c
commit
3234ab5b24
|
@ -66,6 +66,7 @@
|
|||
|
||||
view-attr
|
||||
update-view-attr
|
||||
remove-view-attr
|
||||
|
||||
view-css
|
||||
update-view-css
|
||||
|
|
|
@ -223,6 +223,22 @@
|
|||
});
|
||||
};
|
||||
|
||||
MockView.prototype.removeAttr = function(name) {
|
||||
return this.act(
|
||||
function(cursor) {
|
||||
return cursor.replaceNode([$(shallowCloneNode(cursor.node[0]))
|
||||
.removeAttr(name).get(0)]
|
||||
.concat(cursor.node.slice(1)));
|
||||
},
|
||||
function(eventHandlers) {
|
||||
return eventHandlers;
|
||||
},
|
||||
function(view) {
|
||||
$(view.focus).removeAttr(name);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1907,6 +1923,14 @@
|
|||
return view.updateAttr(name, value);
|
||||
});
|
||||
|
||||
EXPORTS['remove-view-attr'] = makePrimitiveProcedure(
|
||||
'remove-view-attr',
|
||||
2,
|
||||
function(MACHINE) {
|
||||
var view = checkMockViewOnElement(MACHINE, 'remove-view-attr', 0);
|
||||
var name = checkSymbolOrString(MACHINE, 'remove-view-attr', 1).toString();
|
||||
return view.removeAttr(name);
|
||||
});
|
||||
|
||||
EXPORTS['view-css'] = makePrimitiveProcedure(
|
||||
'view-css',
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
view-backward
|
||||
|
||||
view-text update-view-text
|
||||
view-attr update-view-attr
|
||||
view-attr update-view-attr remove-view-attr
|
||||
view-css update-view-css
|
||||
view-id
|
||||
|
||||
|
@ -151,6 +151,9 @@
|
|||
(define (update-view-attr v attr-name value)
|
||||
(error 'update-view-attr "Please run in JavaScript context."))
|
||||
|
||||
(define (remove-view-attr v attr-name)
|
||||
(error 'remove-view-attr "Please run in JavaScript context."))
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user