5 June 2014 TC39 Meeting Notes

C. Scott Ananian ecmascript at cscott.net
Fri Jun 13 10:12:41 PDT 2014

On Fri, Jun 13, 2014 at 12:57 PM, Rick Waldron <waldron.rick at gmail.com> wrote:
> On Fri, Jun 13, 2014 at 12:53 PM, Anne van Kesteren <annevk at annevk.nl>
> wrote:
>> On Fri, Jun 13, 2014 at 6:45 PM, Mark S. Miller <erights at google.com>
>> wrote:
>> > Hi Anne, I didn't understand the answer. When an old browser that knows
>> > nothing of <module> specifically sees "<table><module></table>", does it
>> > consider the <module> to be closed when it sees the </table> ? This also
>> > raises the question: Does such an old browser consider the <table> to be
>> > closed by this occurrence of </table>?
>> Yes and yes. I recommend playing with
>> http://software.hixie.ch/utilities/js/live-dom-viewer/ if you do not
>> want to read the algorithm in the specification. The tree it generates
>> might surprise you. Be sure to switch out <module> with <script> for
>> differences ;-)
> To be clear, you're referring to the automatic placement of <module> as a
> descendant of BODY even if it's explicitly written inside <head></head> (but
> not for <script>)?

There are a number of interesting effects.

1) Only certain tags can live inside `<head>`; the other tags are
automatically moved into `<body>`.  So:
  `<html><head><module></module></head></html>` gets parsed as

2) Only certain tags can live inside `<table>`; other tags are "foster
parented" above the `<table>`.  So:
   `<html><body><table><module></module>` is parsed as

3) Since `<module>` doesn't exist in the current HTML spec, "old
browsers" will use the generic "data state" rules for parsing the body
and finding the end tag. So:
   `<html><script>console.log("&")` prints four characters, but
   `<html><module>console.log(&")` prints one character
   `<b>a<script>b</b>c</script>d` is parsed as
`<b>a<script>b</b>c</script>d</b>` (that is, there is a literal </b>
in the script data), but:
   `<b>a<module>b</b>c</module>d` is parsed as `<b>a<module>b</module></b>cd`

There are more, but these are the main effects of using an generic tag name.

More information about the es-discuss mailing list