• Dmitry Gozman's avatar
    [DevTools] Introduce UI.Fragment · 48b444dd
    Dmitry Gozman authored
    Fragment is a piece of DOM generated from a template string,
    to be used instead of manual dom construction.
    
    - Allows functions ("binds") to be executed during instantiation:
        <div ${(fragment, node) => node._owner = fragment} />.
    
    - Exposes selected elements via $:
        <div $=myName />.
    
    - Toggling states which affect arbitrary attributes:
        <div s-selected-attr=value /> changes the value of "attr" to "value".
    
    - Inserting elements into markup:
        <div>Some ${myDiv} text</div>.
    
    - Inserting text into markup:
        <div>Some ${myText} text</div>.
    
    - Composed attribute names:
        <div ${foo ? 'foo' : 'bar'}-name=value />.
    
    - Transforms <x-shadow> to shadow root:
        <div><x-shadow>dark dom here</x-shadow></div>.
    
    - Caching preprocessed template if needed.
    
    Bug: none
    Change-Id: Ib1eb7c10b0f3f4aaebf98c022697111f38d55f9f
    Reviewed-on: https://chromium-review.googlesource.com/809952Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
    Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#523680}
    48b444dd
BUILD.gn 48.4 KB