This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23814 - [Explainer]: Scoped evaluation of Script tag for custom elements and decorator events
Summary: [Explainer]: Scoped evaluation of Script tag for custom elements and decorato...
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14949
  Show dependency treegraph
 
Reported: 2013-11-13 13:30 UTC by Jonathan Kingston
Modified: 2014-01-20 01:57 UTC (History)
1 user (show)

See Also:


Attachments

Description Jonathan Kingston 2013-11-13 13:30:04 UTC
This bug is regarding an issue in the new evaluation of script tags in the DOM in the draft: http://w3c.github.io/webcomponents/explainer/

The document explains that the following code will add methods to a custom element:
<element name="tick-tock-clock">
  <script>
    ({
      tick: function () {
        …
      }
    });
  </script>
</element>

The document also explains that the following will declare decorator events:
<decorator id="details-open">
    <script>
        function clicked(event) {
            event.target.removeAttribute('open');
        }
        [{selector: '#summary', type: 'click', handler: clicked}];
    </script>


The issue is that <script> tags currently don't evaluate the last statement of the code block.

Either the issue is that this feature should be removed for something that is currently capable for example by exposing a new Element object:
<element name="tick-tock-clock">
  <script>
    Element.methods({
      tick: function () {
        …
      }
    });
  </script>
</element>

The alternative is that the custom element specification and the future decorator specification needs to explain how this functionality will operate.
I would suggest also a separate specification to explain how this would work in the general case also, so future specifications can use the 'script interface' specification for example for future tag interfaces.
Comment 1 Dominic Cooney 2014-01-20 01:57:48 UTC
Thanks for the bug report. The <element> element has been removed from the spec, and no vendor is working to specify decorators now, so I am marking this as "wontfix". I'm working to update the Explainer to remove those sections now.