diff --git a/web-world/impl.rkt b/web-world/impl.rkt index 2748e5c..e812357 100644 --- a/web-world/impl.rkt +++ b/web-world/impl.rkt @@ -66,6 +66,7 @@ view-attr update-view-attr + remove-view-attr view-css update-view-css diff --git a/web-world/js-impl.js b/web-world/js-impl.js index d0c4915..ce72aef 100644 --- a/web-world/js-impl.js +++ b/web-world/js-impl.js @@ -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', diff --git a/web-world/racket-impl.rkt b/web-world/racket-impl.rkt index 1b097c4..91598e9 100644 --- a/web-world/racket-impl.rkt +++ b/web-world/racket-impl.rkt @@ -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.")) +