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 25582 - [DOM-P&S] Two short questions
Summary: [DOM-P&S] Two short questions
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM Parsing and Serialization (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Travis Leithead [MSFT]
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-06 17:26 UTC by Arkadiusz Michalski (Spirit)
Modified: 2014-05-29 15:29 UTC (History)
2 users (show)

See Also:


Attachments

Description Arkadiusz Michalski (Spirit) 2014-05-06 17:26:41 UTC
Two short questions for better clarification:

===

5.1 Methods
  
parseFromString()

3. Let document be a newly-created XML Document. The document will use the Document interface rather than the XMLDocument interface.

Now Firefox, Chrome and IE use XMLDocument interface. Only Firefox in this case support XMLDocument.load() method and we can load file using this method:
http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-xmldocument-load

Any official discussions, mailing lists, explanations why it has to be Document?

===

Concept with text.serializeAsCDATA (http://domparsing.spec.whatwg.org/#extensions-to-the-text-interface) has been completely abandoned? Any official discussions, mailing lists, explanations where we can read why? I try make some research but see only one bug for Firefox:
https://bugzilla.mozilla.org/show_bug.cgi?id=660660
Comment 1 Arkadiusz Michalski (Spirit) 2014-05-06 17:34:38 UTC
I forgot that old Presto 12.x also support XMLDocument interface and XMLDocument.load() method.
Comment 2 Travis Leithead [MSFT] 2014-05-06 23:06:20 UTC
On the XMLDocument issue--the idea is not so much which constructor is manifest by the returned document, but what the "internal" document nature is (and this is not super-obvious)--whether it (and it's many relevant APIs contingent on this behavior--not just in this spec) act like an XML document or an HTML document.

Historically, there was only a "uni-document"--the same document interface used for all kinds of documents. This simplified things. That is largely how it works in browsers today, though they will expose an HTMLDocument and XMLDocument interface for web compat.

I'll need to do a bit of research to see what instance mapping the parseFromString's document should be associated with.

== 

Regarding text.serializeAsCDATA, this new feature was dropped from this spec in order to move it along to REC faster. It could be included, but would be marked 'at risk' and removed eventually anyway if two implementations did not support it.

It may be a candidate for the next edition of this spec if there is still implementation interest (for it or for a second edition of DOM P&S), and I'd be happy to re-add it.
Comment 3 Arkadiusz Michalski (Spirit) 2014-05-06 23:25:03 UTC
Ok, thx for the clarification.

Regarding parseFromString() something else interested me:

"text/html" 
[The scripting flag must be set to "disabled".]

This apply only for this type or should be apply to more?


And origin, don't see any info about it for new document. 
In DOM we have some step:
http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument

This bug exist in WHATWG section:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15916
Comment 4 Travis Leithead [MSFT] 2014-05-06 23:49:04 UTC
> Regarding parseFromString() something else interested me:
> 
> "text/html" 
> [The scripting flag must be set to "disabled".]
> 
> This apply only for this type or should be apply to more?

The "scripting flag" is a concept that only makes sense for the HTML Parser. Thus, I think this is correct. The XML namespace-aware parser processing XHTML will presumably also not execute the script--but here I am less sure, and will need to check. (Most browsers route the elements created by the XML Parser that are in the HTML namespace through the same underlying processing code that handles HTML elements, so this wouldn't surprise me.) If this turns out to be true I may need to invent something to indicate that this same flag should be set for XHTML script elements...


> And origin, don't see any info about it for new document. 
> In DOM we have some step:
> http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
> http://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
> 
> This bug exist in WHATWG section:
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=15916

The spec mentions that:
   "Additionally, the document must have a URL value equal to the URL of the active document, a location value of null."

So its "origin" as I think I understand it, is the same as the main document. I may need to clarify this though??
Comment 5 Arkadiusz Michalski (Spirit) 2014-05-07 00:10:03 UTC
> The "scripting flag" is a concept that only makes sense for the HTML Parser.
> Thus, I think this is correct. The XML namespace-aware parser processing
> XHTML will presumably also not execute the script--but here I am less sure,
> and will need to check. (Most browsers route the elements created by the XML
> Parser that are in the HTML namespace through the same underlying processing
> code that handles HTML elements, so this wouldn't surprise me.) If this
> turns out to be true I may need to invent something to indicate that this
> same flag should be set for XHTML script elements...

In other cases (variety of XML) this flag (or behaviour) fit for XHTML script elements (when use correct namespace).

>The spec mentions that:
>   "Additionally, the document must have a URL value equal to the URL of the >active document, a location value of null."

> So its "origin" as I think I understand it, is the same as the main
> document. I may need to clarify this though??
 
Yuuup, in fact it should be enough, my mistake.
Comment 6 Travis Leithead [MSFT] 2014-05-23 16:20:25 UTC
(In reply to Travis Leithead [MSFT] from comment #2)
> I'll need to do a bit of research to see what instance mapping the
> parseFromString's document should be associated with.

Oh, I just noticed that you did the research for me in Comment 0. Oh well, I confirmed it :-)

I did some digging and found this IRC log on WHATWG that seemed related:
http://krijnhoetmer.nl/irc-logs/whatwg/20140313#l-293

Which led me to: https://bugzilla.mozilla.org/show_bug.cgi?id=983090

From what I can piece together, the change to use a vanilla Document object is to avoid having to support the .load API for the documents created by parseFromString. This may be an interim requirement if Mozilla pulls support for .load, after which it won't matter quite so much if the XMLDocument constructor is used. Regardless, there's no harm in the current text, and I think it was considered the best option going forward, so I prefer to stick with it.
Comment 7 Travis Leithead [MSFT] 2014-05-23 16:40:37 UTC
(In reply to spiritRKS1910 from comment #5)
> > The "scripting flag" is a concept that only makes sense for the HTML Parser.
> > Thus, I think this is correct. The XML namespace-aware parser processing
> > XHTML will presumably also not execute the script--but here I am less sure,
> > and will need to check. (Most browsers route the elements created by the XML
> > Parser that are in the HTML namespace through the same underlying processing
> > code that handles HTML elements, so this wouldn't surprise me.) If this
> > turns out to be true I may need to invent something to indicate that this
> > same flag should be set for XHTML script elements...
> 
> In other cases (variety of XML) this flag (or behaviour) fit for XHTML
> script elements (when use correct namespace).

I will add a note to the spec to clarify this point.
Comment 8 Travis Leithead [MSFT] 2014-05-23 16:45:10 UTC
Note added.

https://dvcs.w3.org/hg/innerhtml/rev/8dbd8dbdefdc
Comment 9 Arkadiusz Michalski (Spirit) 2014-05-29 15:29:22 UTC
Now everything is clear. I have nothing to add.