Open Aurelain opened 7 years ago
I will be retooling attribute code to use attributeChanged callback. This was a historical issue back when the spec was that attribute change was a async flow, which sucks unless you had promises or something to prevent race code. We wanted to enforce sanity, but I should redo that code now that the spec matches our philosophy.
On Aug 30, 2016 6:54 AM, "Aurelain" notifications@github.com wrote:
Consider the following code:
xtag.register('x-foo', { lifecycle: { attributeChanged: function () { console.log('attributeChanged'); } }, accessors: { bar: { attribute: {}, get: function () { return this.xtag.bar; }, set: function (value) { this.xtag.bar = value; console.log('setter'); } } } }); var foo = document.createElement('x-foo'); foo.setAttribute('bar', '1'); // attributeChanged, setter foo.attributes.bar.value = '2'; // attributeChanged console.log(foo.getAttribute('bar')); // 2 console.log(foo.bar); // 1 (should be 2!)
In my view, attributes.x.value should act exactly like setAttribute.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/x-tag/core/issues/162, or mute the thread https://github.com/notifications/unsubscribe-auth/AAICynVv8dXE7q5wg7PdSQkUlK5TlJMpks5qlDYYgaJpZM4JwjVm .
I am just running the modified code through our tests to assure 1:1 output from the previous setup. Should have this out before the end of the month.
whats the status on this?
I am off for 30 days starting December 13th, and will be finishing the last major update to the 1.x branch that covers this.
@csuwildcat word, happy holidays my man. x-tag is very likely the coolest christmas/hanukkah present I'll get this year, so that pretty much makes you 🎅🏽 (seriously tho, thanks for all the work on this! it's an awesome project.)
Consider the following code:
In my view,
attributes.x.value
should act exactly likesetAttribute
.