adding method for checking presence or absence of attribute
This commit is contained in:
parent
dd01373ae5
commit
d6fb2ff295
|
@ -65,6 +65,7 @@
|
|||
view-hide
|
||||
|
||||
view-attr
|
||||
view-has-attr?
|
||||
update-view-attr
|
||||
remove-view-attr
|
||||
|
||||
|
|
|
@ -216,6 +216,10 @@
|
|||
return $(this.cursor.node[0]).attr(name);
|
||||
};
|
||||
|
||||
MockView.prototype.hasAttr = function(name) {
|
||||
return $(this.cursor.node[0]).attr(name) !== undefined;
|
||||
};
|
||||
|
||||
|
||||
MockView.prototype.updateAttr = function(name, value) {
|
||||
return this.act(
|
||||
|
@ -1923,6 +1927,14 @@
|
|||
return view.getAttr(name);
|
||||
});
|
||||
|
||||
EXPORTS['view-has-attr?'] = makePrimitiveProcedure(
|
||||
'view-has-attr?',
|
||||
2,
|
||||
function(MACHINE) {
|
||||
var view = checkMockViewOnElement(MACHINE, 'view-has-attr?', 0);
|
||||
var name = checkSymbolOrString(MACHINE, 'view-has-attr?', 1).toString();
|
||||
return view.hasAttr(name);
|
||||
});
|
||||
|
||||
EXPORTS['update-view-attr'] = makePrimitiveProcedure(
|
||||
'update-view-attr',
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
view-backward
|
||||
|
||||
view-text update-view-text
|
||||
view-attr update-view-attr remove-view-attr
|
||||
view-attr view-has-attr? update-view-attr remove-view-attr
|
||||
view-css update-view-css
|
||||
view-id
|
||||
|
||||
|
@ -148,6 +148,9 @@
|
|||
(define (view-attr v attr-name)
|
||||
(error 'view-attr "Please run in JavaScript context."))
|
||||
|
||||
(define (view-has-attr? v attr-name)
|
||||
(error 'view-has-attr? "Please run in JavaScript context."))
|
||||
|
||||
(define (update-view-attr v attr-name value)
|
||||
(error 'update-view-attr "Please run in JavaScript context."))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user