-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom elements should not upgrade elements by setting prototype (bugzilla: 28544) #134
Labels
Comments
domenic
added a commit
that referenced
this issue
Mar 1, 2016
Notable changes: - Implemented HTMLElement constructor using @rniwa's algorithm from #403. - Rewrote element upgrading to use @rniwa's algorithm from #403, and incorporated it into the rest of the upgrading considerations. - Got rid of the ability to extend SVGElement, thus allowing us to remove most mentions of namespaces from the spec. - Removed createdCallback. - Rewrote "registering elements": - Uses defineElement instead of registerElement - Preserves the constructor instead of grabbing the .prototype property and synthesizing a new constructor - No longer spread out over four separate algorithms plus registerElement; everything is now inline under defineElement - More precise about exactly how to get the custom element prototype and callbacks - Rewrote createElement and createElementNS to be replacements instead of patches, and to call the author-supplied constructor. - Removed the "All Algorithms in One Diagram" section since so many algorithms changed or were inlined into their callers. - Removed the "Custom Elements and ECMAScript 6" section since it is very obsolete and does not reflect our current thinking. - New and rewritten algorithms do not use the unorthodox INPUTS/OUTPUTS blocks, or capitalized variable names. This is kind of a nice marker of new vs. old content. Notable things *not* substantially changed: - Parser changes are not specced still, besides to say that they should construct the element using its constructor. - Lifecycle callbacks were not changed, except for removing createdCallback. - Type extensions were not removed (yet?); it seems better to have a modernized version of them that we atomically remove. - Registries were not made available everywhere. Closes #403. Closes #365. Closes #283. Closes #185. Closes #170. Closes #169. Closes #167. Closes #163. Closes #162. Closes #161. Closes #158. Clsoes #137 (modulo the fact that #165 is still open). Closes #134. Closes #133.
domenic
added a commit
that referenced
this issue
Mar 1, 2016
Notable changes: - Implemented HTMLElement constructor using @rniwa's algorithm from #403. - Rewrote element upgrading to use @rniwa's algorithm from #403, and incorporated it into the rest of the upgrading considerations. - Got rid of the ability to extend SVGElement, thus allowing us to remove most mentions of namespaces from the spec. - Removed createdCallback. - Rewrote "registering elements": - Uses defineElement instead of registerElement - Preserves the constructor instead of grabbing the .prototype property and synthesizing a new constructor - No longer spread out over four separate algorithms plus registerElement; everything is now inline under defineElement - More precise about exactly how to get the custom element prototype and callbacks - Rewrote createElement and createElementNS to be replacements instead of patches, and to call the author-supplied constructor. - Removed the "All Algorithms in One Diagram" section since so many algorithms changed or were inlined into their callers. - Removed the "Custom Elements and ECMAScript 6" section since it is very obsolete and does not reflect our current thinking. - New and rewritten algorithms do not use the unorthodox INPUTS/OUTPUTS blocks, or capitalized variable names. This is kind of a nice marker of new vs. old content. Notable things *not* substantially changed: - Parser changes are not specced still, besides to say that they should construct the element using its constructor. - Lifecycle callbacks were not changed, except for removing createdCallback. - Type extensions were not removed (yet?); it seems better to have a modernized version of them that we atomically remove. - Registries were not made available everywhere. Closes #403. Closes #365. Closes #283. Closes #185. Closes #170. Closes #169. Closes #167. Closes #163. Closes #162. Closes #161. Closes #158. Clsoes #137 (modulo the fact that #165 is still open). Closes #134. Closes #133.
domenic
added a commit
that referenced
this issue
Mar 1, 2016
Notable changes: - Implemented HTMLElement constructor using @rniwa's algorithm from #403. - Rewrote element upgrading to use @rniwa's algorithm from #403, and incorporated it into the rest of the upgrading considerations. - Got rid of the ability to extend SVGElement, thus allowing us to remove most mentions of namespaces from the spec. - Removed createdCallback. - Rewrote "registering elements": - Uses defineElement instead of registerElement - Preserves the constructor instead of grabbing the .prototype property and synthesizing a new constructor - No longer spread out over four separate algorithms plus registerElement; everything is now inline under defineElement - More precise about exactly how to get the custom element prototype and callbacks - Rewrote createElement and createElementNS to be replacements instead of patches, and to call the author-supplied constructor. - Removed the "All Algorithms in One Diagram" section since so many algorithms changed or were inlined into their callers. - Removed the "Custom Elements and ECMAScript 6" section since it is very obsolete and does not reflect our current thinking. - New and rewritten algorithms do not use the unorthodox INPUTS/OUTPUTS blocks, or capitalized variable names. This is kind of a nice marker of new vs. old content. Notable things *not* substantially changed: - Parser changes are not specced still, besides to say that they should construct the element using its constructor. - Lifecycle callbacks were not changed, except for removing createdCallback. - Type extensions were not removed (yet?); it seems better to have a modernized version of them that we atomically remove. - Registries were not made available everywhere. Closes #403. Closes #365. Closes #283. Closes #185. Closes #170. Closes #169. Closes #167. Closes #163. Closes #162. Closes #161. Closes #158. Closes #137 (modulo the fact that #165 is still open). Closes #134. Closes #133.
domenic
added a commit
that referenced
this issue
Mar 1, 2016
Notable changes: - Implemented HTMLElement constructor using @rniwa's algorithm from #403. - Rewrote element upgrading to use @rniwa's algorithm from #403, and incorporated it into the rest of the upgrading considerations. - Got rid of the ability to extend SVGElement, thus allowing us to remove most mentions of namespaces from the spec. - Removed createdCallback. - Rewrote "registering elements": - Uses defineElement instead of registerElement - Preserves the constructor instead of grabbing the .prototype property and synthesizing a new constructor - No longer spread out over four separate algorithms plus registerElement; everything is now inline under defineElement - More precise about exactly how to get the custom element prototype and callbacks - Rewrote createElement and createElementNS to be replacements instead of patches, and to call the author-supplied constructor. - Removed the "All Algorithms in One Diagram" section since so many algorithms changed or were inlined into their callers. - Removed the "Custom Elements and ECMAScript 6" section since it is very obsolete and does not reflect our current thinking. - New and rewritten algorithms do not use the unorthodox INPUTS/OUTPUTS blocks, or capitalized variable names. This is kind of a nice marker of new vs. old content. Notable things *not* substantially changed: - Parser changes are not specced still, besides to say that they should construct the element using its constructor. - Lifecycle callbacks were not changed, except for removing createdCallback. - Type extensions were not removed (yet?); it seems better to have a modernized version of them that we atomically remove. - Registries were not made available everywhere. Closes #403. Closes #365. Closes #283. Closes #185. Closes #170. Closes #169. Closes #167. Closes #163. Closes #162. Closes #161. Closes #158. Closes #137 (modulo the fact that #165 is still open). Closes #134. Closes #133.
domenic
added a commit
that referenced
this issue
Mar 3, 2016
Notable changes: - Implemented HTMLElement constructor using @rniwa's algorithm from #403. - Rewrote element upgrading to use @rniwa's algorithm from #403, and incorporated it into the rest of the upgrading considerations. - Got rid of the ability to extend SVGElement, thus allowing us to remove most mentions of namespaces from the spec. - Removed createdCallback. - Rewrote "registering elements": - Uses defineElement instead of registerElement - Preserves the constructor instead of grabbing the .prototype property and synthesizing a new constructor - No longer spread out over four separate algorithms plus registerElement; everything is now inline under defineElement - More precise about exactly how to get the custom element prototype and callbacks - Rewrote createElement and createElementNS to be replacements instead of patches, and to call the author-supplied constructor. - Removed the "All Algorithms in One Diagram" section since so many algorithms changed or were inlined into their callers. - Removed the "Custom Elements and ECMAScript 6" section since it is very obsolete and does not reflect our current thinking. - New and rewritten algorithms do not use the unorthodox INPUTS/OUTPUTS blocks, or capitalized variable names. This is kind of a nice marker of new vs. old content. - I have taken over as spec editor for custom elements Notable things *not* substantially changed: - Parser changes are not specced still, besides to say that they should construct the element using its constructor. - Lifecycle callbacks were not changed, except for removing createdCallback. - Type extensions were not removed (yet?); it seems better to have a modernized version of them that we atomically remove. - Registries were not made available everywhere. Closes #403. Closes #365. Closes #283. Closes #185. Closes #170. Closes #169. Closes #167. Closes #163. Closes #162. Closes #161. Closes #158. Closes #137 (modulo the fact that #165 is still open). Closes #134. Closes #133.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Title: Custom elements should not upgrade elements by setting prototype (bugzilla: 28544)
Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c0
Ryosuke Niwa wrote on 2015-04-22 23:45:08 +0000.
Discussed here:
https://lists.w3.org/Archives/Public/public-webapps/2014JanMar/0158.html
https://lists.w3.org/Archives/Public/public-webapps/2015JanMar/0083.html
We shouldn't support upgrading of existing elements since it leaves the corresponding DOM objects with a wrong identity.
This is also not a normal programming model. Even with ES6 modules, we don't create a dummy modules while modules are loading and later automatically replace them under the foot.
comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c1
Domenic Denicola wrote on 2015-04-22 23:52:35 +0000.
This is exactly what we do with ES6 modules.
comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c2
Ryosuke Niwa wrote on 2015-04-22 23:57:31 +0000.
(In reply to Domenic Denicola from comment #1)
How? import { myClass } from 'mymodule'; doesn't create a promise or anything. It'll just block until mymodule is loaded.
comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c3
Domenic Denicola wrote on 2015-04-22 23:58:58 +0000.
Referencing myClass will be a reference error until 'mymodule' is loaded. This normally comes up in the case of circular dependencies.
comment: 4
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c4
Ryosuke Niwa wrote on 2015-04-23 00:35:18 +0000.
(In reply to Domenic Denicola from comment #3)
I'm not certain what you mean by "until 'mymodule' is loaded' but the 'mymodule' will be synchronously fetched and evaluated before the following statements are executed.
e.g.
import { myClass } from 'mymodule'; // (1)
new myClass; // this line of code is never executed until (1) is done executing.
The fact we can encounter a circular dependency in (1) is an orthogonal issue. The fact of matter is that the declarative syntax for importing an ES6 module DOES synchronously block the script execution.
comment: 5
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c5
Domenic Denicola wrote on 2015-04-23 01:23:23 +0000.
It is correct that (2) will not execute until (1) is done executing. But (1) simply creates a dummy myClass binding which will cause ReferenceErrors if executed before myClass's definition is evaluated. myClass's definition may or may not be evaluated by executing (1).
Here is a simple example:
// a.js
import * as bModule from './b.js';
import { b } from './b.js';
// bModule is a dummy module with no properties
// if b is referenced it will cause a ReferenceError
// console.log(b); // fails
export let a = 1;
setTimeout(() => {
// bModule is no longer a dummy module and has a b property
// b can be referenced without errors
console.log(b); // works
}, 100);
////////
// b.js
import * as aModule from './a.js';
import { a } from './a.js';
export let b = 2;
////////
// entry.js
import './b.js';
Execution order is entry.js -> a.js -> b.js. Thus inside a.js we have the dummy module which later gets upgraded. In fact this happens for a.js (and entry.js) as well, but you don't observe that since you can't see them pre-upgrade.
comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c6
Ryosuke Niwa wrote on 2015-04-23 02:09:24 +0000.
Again, even in this example, files are fetched and evaluated synchronously.
But let us not derail this bug from the main topic, which is about not upgrading custom elements. Even if my statement about class wasn't accurate, the fact that upgrading existing elements is a bad idea wouldn't change.
comment: 7
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c7
Domenic Denicola wrote on 2015-04-23 02:11:11 +0000.
I think it's very relevant. In a dynamic system with interdependencies, upgrading of some sort is important. We have it for ES6 modules, and it makes just as much sense for custom elements, for the same reasons.
comment: 8
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28544#c8
Ryosuke Niwa wrote on 2015-04-23 02:42:25 +0000.
(In reply to Domenic Denicola from comment #7)
Why?
The text was updated successfully, but these errors were encountered: