Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createDocument() should use namespace to set content type #217

Closed
annevk opened this issue Apr 13, 2016 · 19 comments
Closed

createDocument() should use namespace to set content type #217

annevk opened this issue Apr 13, 2016 · 19 comments
Assignees

Comments

@annevk
Copy link
Member

annevk commented Apr 13, 2016

See #213 (comment) onwards for feedback from @ayg, @foolip, and @ArkadiuszMichalski on this.

@ayg
Copy link
Contributor

ayg commented Apr 13, 2016

What should we cover? XHTML, SVG, MathML, anything else?

@ayg ayg self-assigned this Apr 13, 2016
ayg added a commit to ayg/web-platform-tests that referenced this issue Apr 13, 2016
Update for whatwg/dom@c8ae9cbd.  This assumes that whatwg/dom#217 is
resolved, so createDocument() is expected to provide a contentType based
on the namespace instead of always application/xml.
ayg added a commit to ayg/dom that referenced this issue Apr 13, 2016
@zcorpan
Copy link
Member

zcorpan commented Apr 13, 2016

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4055

Gecko/Presto Chromium/WebKit Edge
log: application/xml
log: application/xml
log: application/xml
log: application/xhtml+xml
log: image/svg+xml
log: application/xml
?

Also new Document()?

@foolip
Copy link
Member

foolip commented Apr 13, 2016

I tested in Edge and it's all undefined, because the contentType attribute isn't supported.

@annevk
Copy link
Member Author

annevk commented Apr 13, 2016

Note that Gecko has some varying based on the doctype, but I don't think anyone else does so that can hopefully be removed: https://bugzilla.mozilla.org/show_bug.cgi?id=520969.

@ayg
Copy link
Contributor

ayg commented Apr 13, 2016

I don't think Gecko actually varies contentType here, only the type of document produced (HTMLDocument vs. SVGDocument vs. XMLDocument).

@ArkadiuszMichalski
Copy link
Contributor

@zcorpan new Document() is fresh and use default content type application/xml, any other engine than Gecko supports this constructor?

@zcorpan
Copy link
Member

zcorpan commented Apr 13, 2016

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4057

It seems WebKit also supports it; uses application/xml. However, that type is less useful than application/xhtml+xml given that createElement uses null as namespace. My thought is then if new Document() could be changed to application/xhtml+xml.

But maybe that conflicts with HTMLDocument vs. Document -- if we have to change how that works in the specs as well... http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4058 logs false in WebKit/Chromium/Gecko.

@ayg
Copy link
Contributor

ayg commented Apr 14, 2016

I think we should make the same change for new Document(), because it's more useful to have a reasonable .contentType.

@foolip
Copy link
Member

foolip commented Apr 14, 2016

Somewhat on topic, it would be neat if contentType could replace https://dom.spec.whatwg.org/#concept-document-type and thereby the "HTML document", so that all document type tests could be of the type done in #213

@zcorpan
Copy link
Member

zcorpan commented Apr 14, 2016

@ayg I agree it would be more useful, but it would be particularly weird if we then have to split Document and HTMLDocument. If that happens maybe a better thing to do is to provide a constructor for HTMLDocument?

@annevk
Copy link
Member Author

annevk commented Apr 14, 2016

@foolip that seems rather tricky, since we need to enumerate all possible content type values that HTML uses for HTML documents then.

@foolip
Copy link
Member

foolip commented Apr 14, 2016

I was hoping it was just text/html, or that at least it'd be web compatible to always return text/html if it's treated as an HTML document, but maybe I'm being too optimistic?

@annevk
Copy link
Member Author

annevk commented Apr 14, 2016

The HTML standard requires numerous content types for text loading, media loading, etc.

@ayg
Copy link
Contributor

ayg commented Apr 14, 2016

@zcorpan Why would we have to split Document and HTMLDocument?

@annevk
Copy link
Member Author

annevk commented Apr 14, 2016

However, perhaps the supported set of XML content types would be small enough. Anyway, we should really discuss this in a distinct issue.

@zcorpan
Copy link
Member

zcorpan commented Apr 14, 2016

@ayg hopefully we don't, but nobody has implemented what's currently specified.

@ayg
Copy link
Contributor

ayg commented Apr 14, 2016

@zcorpan Okay, but how would this relate to splitting Document and HTMLDocument? (Which maybe we should split anyway, #221.)

@zcorpan
Copy link
Member

zcorpan commented Apr 14, 2016

If new Document() creates a Document of type application/xhtml+xml, that would be inconsistent with loading an application/xhtml+xml resource into a browsing context which would instead be HTMLDocument (I assumed, but reading #221 maybe HTMLDocument can be used only for "html" mode documents instead, if it is unmerged...)

@ayg
Copy link
Contributor

ayg commented Apr 17, 2016

Hopefully we won't have to split them, and if we do the difference should be marginal (one or two methods or properties different), so it doesn't bother me much.

ayg added a commit to ayg/dom that referenced this issue Apr 17, 2016
@annevk annevk closed this as completed in 537e579 Apr 18, 2016
tabatkins added a commit to tabatkins/dom that referenced this issue Apr 28, 2016
* Add more legacy event types for createEvent()

Approximately as requested at
https://bugzilla.mozilla.org/show_bug.cgi?id=1251198#c7. This is the
list of events supported in createEvent() by at least two of Firefox,
Chrome, and IE 11. The one exception is I omitted MutationEvent,
which all three support, because apparently spec-land has decided to
deny its existence in the hope that it will go away.

Bikeshed does not know about all of the added interface names,
hopefully that will sort itself out over time.

* Meta: improve pull request instructions for DOM

See whatwg/fetch#276 for context.

* Enable an event listener to be invoked just once

* Editorial: web compatibility typically remains relevant

Fixes whatwg#210.

* Shadow: define attachShadow() for custom elements

* Meta: make it easier to reference participate in a tree

PR: whatwg#216

* Define node document for new Text nodes

Fixes whatwg#224 and part of whatwg#212. Also fix part of whatwg#209 by stating these
algorithms can rethrow exceptions.

* Use a single concept for attribute changes

This setup is still a little sketchy I think, but not more so than the
insertion and removing steps.

* SVGEvent is only Gecko, Blink also has SVGEvents

As pointed out by zcorpan in whatwg#227.

* Set createDocument()'s content type based on namespace

Fixes whatwg#217.

PR: whatwg#218

* Make document.createEvent("touchevent") sometimes throw

Browsers typically disable touch events on non-touch devices, and there exists web content that detects this difference using document.createEvent().

Fixes whatwg#227.

* Shadow: define slotchange event

Shadow: define slotchange event

Fixes WICG/webcomponents#288.

This defines the slotchange event in response to remove/insert operations, changes to a slot’s name attribute, and changes to an element’s slot attribute.

This also introduces the assigned nodes concept for slots, and assigned slot concept for slotables.

Slotables now also have a name, rather than a “get name”.

The slotchange event dispatches just after mutation observers have their callbacks invoked. The slotchange event is not yet marked scoped as scoped events are not yet defined in the DOM Standard.

Note: although the original issue did not mention it, this also suppresses signaling when slots are removed from a tree. Not just when they are inserted.

* Editorial: update custom element cross-spec references

* Editorial: fix a few cross-linking missteps

* Editorial: make "is" and "prefix" optional in "create an element"

* Use "create an element" in createHTMLDocument

Takes care of part of whatwg#212.

* Editorial: align exception language with IDL

* Editorial: introduce more shadow-including terms for CSS

Fixes whatwg#225.

* Editorial: distributed -> flattened

* Meta: export more terms

Fixes whatwg#233.

* Editorial: add "shadow host" and "assigned" as terms

This makes a couple of non-null checks read better and enshrines a term
we had already been using.

* Editorial: flip non-null/otherwise conditions

PR: whatwg#234

* Shadow: <slot> is now defined in HTML

* Remove passive as event listener key

This changes makes passive no longer contribute to the uniqueness of
an event listener. It therefore also no longer needs to be supported
as part of removeEventListener().

Fixes WICG/EventListenerOptions#27.

PR: whatwg#236

* Meta: point out event's timeStamp is likely to change

See whatwg#23 for details.

* Add [CEReactions] annotations to mutating methods

Part of WICG/webcomponents#186, and furthering whatwg/html@27aa7bc.

Linking [CEREactions] will happen once speced/bikeshed#677 is fixed.

* Editorial: check stop propagation flag at start of invoke

* Editorial: deduplicate Veli Şenol

* Editorial: define defaults for EventListenerOptions

Although this is also done in prose, this nonetheless simplifies the
prose a bit and makes it clearer to those skimming the standard what is
going on (although skimming is not recommended).

Fixes whatwg#239.

* Meta: link to Japanese translation

See
triple-underscore/triple-underscore.github.io#1
for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants