Changes between Initial Version and Version 1 of WebComponents2016

Oct 26, 2016 1:17:41 PM (6 years ago)
Jon Davis



  • WebComponents2016

    v1 v1  
     1= Web Components =
     3Web components are a feature to modularize the web.
     5Four features:
     6Html templates (done)
     7Shadow DOM (bug fixing)
     8Custom Elements (wip)
     9Html Imports (waiting on modules)
     11Html templates are a way to fix parser.
     12One problem with HTML parser there is not valid html for every possible DOM tree.
     15Shadow DOM:
     16Represents a parallel tree.
     18One problem is that in DOM for example Styles can apply to things that they were not intended to apply to.
     19In the shadow DOM, there is a boundary between styles in the old DOM and shadow DOM.
     22For a DIV there is a ShadowRoot that can have SLOTs. SLOT can say to set a property.
     24There are three types of Shadow DOM in WebKit:
     25UserAgent, Closed, Open.
     27In WebKit there are three names for the rendered tree:
     28Composed tree == flat tree == rendered tree
     30There are also two ways to iterate:
     31Within a given tree -> parentNode
     32Across shadow trees
     33Don’t use the
     35Custom Elements:
     36Allows users to give custom names to elements.
     38Custom Elements are allowed to add various callbacks that are called when things happen in the Shadow tree.
     40Callbacks are almost Synchronous:
     41They are not quite synchronous since it calls from C++ to JS.
     43When callbacks are set to be called we create a stack of every thing that needs to happen. Then when returning back to JS everything in the stack is executed. Those callbacks may, themselves, call back into Bindings that create their own set of callbacks. It’s important to remember that the tree may not look the expected way after the callback.
     45This stack exists for each element.
     47It’s possible to asynchronously create custom elements.
     48Elements have four states.
     491: A builtin element.
     502: waiting to be upgraded (when createElement is called but the js for a custom element has not been loaded yet)
     53?: Are their possibilities to infinite loop
     54A: yeah.
     56One of the biggest challenges is to ensure that custom elements are not modified outside of the functions marked as allowed to modify the shadow element.
     58The timing of the callbacks was partly designed so that we could avoid security bugs with C++ methods not being robust to the DOM changing under them.
     60?: Is there any ordering of the callbacks
     61A: It’s in tree order.
     63?: In JS can you know if an element is waiting for upgrade
     64A: Yes. There is a whenDefined method.
     66?: Where are the other browsers on this.
     67A: Chrome is done, Firefox is ~6m, Edge… who knows.
     69?: How do we test this.
     70A: Mostly it’s browser specific but maybe we should have a W3C test suite for these things.