DescriptionImplement Blink-in-JS for DOM attributes
* This CL implements the core infrastructure of Blink-in-JS to support DOM attributes.
* Developers can use DOM attributes in Blink-in-JS as follows:
(1) Implement DOM attribute getters/setters in JavaScript.
// Foo.js
installClass("Foo", function(window) {
var FooPrototype = {};
FooPrototype.initialize = function() { // Initialize properties of |this| object.
this.m_attr = "initial value";
}
Object.defineProperty(FooPrototype, "attr", {
get: function() { return this.m_attr; }, // DOM attribute getter
set: function(value) { return this.m_attr = attr; } // DOM attribute setter
})
return FooPrototype;
});
(2) Add an [ImplementedInPrivateScript] IDL attribute to Foo.idl.
// Foo.idl
interface Foo {
[ImplementedInPrivateScript] attribute DOMString attr;
};
* For more details, see changes to Internals.js and Internals.idl.
* bindings/scripts/v8_attributes.py and bindings/templates/attributes.cpp implement the binding layer that connects DOM attributes with private scripts. Only primitive types and DOM wrappers are allowed as types of attribute values used in Blink-in-JS.
BUG=341031
TEST=fast/dom/private_script_unittest.html
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177511
Patch Set 1 #
Total comments: 2
Patch Set 2 : #Patch Set 3 : #Patch Set 4 : #
Total comments: 13
Patch Set 5 : #
Total comments: 4
Patch Set 6 : #Patch Set 7 : #
Total comments: 2
Messages
Total messages: 31 (0 generated)
|