-
Notifications
You must be signed in to change notification settings - Fork 295
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
Clarify that new Document creates a document of type "html", not "xml" #308
Comments
My understanding is that new Document() creates a Document object and its type will be "xml" indeed. |
My understanding is that we use |
If by "we" you mean the specification. All major browsers have an HTMLDocument type. |
All that follows is about specs; implementations have not quite converged. Almost all documents are However, there is a method, In whatwg/html#1478 we removed A further complication: as of 2011 Gecko needs |
Earlier someone has already asked about that #137. Why this constructor can't take additional argument to decide what document (internal xml or html) we want create? Now default is xml so we must use longer |
Well, it's strange for |
We use |
Looks like |
Interesting, does any implementation even support HTML responses for XMLHttpRequest's |
From Blink's source I see that one can get an HTMLDocument, if In the end, are there any APIs other than the Document constructor currently that can return a plain Document, or are they all HTMLDocument or XMLDocument? I suspect that latter. |
Not sure, I suspect you are correct. |
Since this has cropped up on blink-dev again, and @foolip and I have somewhat divergent opinions, let me outline what I think is the correct path forward in specs and implementations:
|
For the record, here is my opinion as well:
If a major browser besides Edge actually manages/decides to move everything from HTMLDocument to Document, then I could be convinced otherwise. However, it has been years and it has not happened. I personally do not think the "benefits" of merging HTMLDocument into Document are worth the effort / risks involved. |
Oh, how did I miss this? It looks like it was none other than @cdumez who added XMLDocument to Blink and WebKit, and recently too: Given that, it seems very likely that it can be made an alias of Document again in non-Gecko engines again, but if Gecko can't follow we'll be stuck in a weird place. If not for the risk for Gecko, everything in #308 (comment) SGTM, including keeping a few things on HTMLDocument that would always throw on Document. @bzbarsky, how do you view the chances that making XMLDocument an alias of Document in Gecko would be web compatible today? What was the original issue? |
To save @bzbarsky some sighing, the original issue was https://www.w3.org/Bugs/Public/show_bug.cgi?id=14037. See also whatwg/html#1478 (comment). In 2011 there was code that UA-sniffs non-"applewebkit" and then uses |
Original issue for what? We don't so much want to put a I feel like this is the 4th or 5th time I've had this conversation, and each time no one (including me) can find the previous instances because we keep switching bug systems and because Github's setup sucks so much for searching (e.g. the document discussion is scattered across issues in multiple repos, and possibly pull requests too). |
Clearly my comment crossed with Domenic's. ;) But case in point: His link to my github comment is to a pull request, not issue, and in the HTML repo, not this one. Searchability, what's that? |
I understand that Gecko needs XMLDocument and XMLDocument.protototype.load. However, now that we dropped XMLDocument.protototype.load from the HTML specification, it seems odd to keep XMLDocument as an interface in the DOM specification. The situation, for years, was that Firefox had XMLDocument / XMLDocument.prototype.load and WebKit / Blink had XMLDocument as an alias to Document. It is unfortunate that Firefox needs XMLDocument / XMLDocument.prototype.load for backward compatibility. However, other browsers do not have XMLDocument.prototype.load (or intend to have) and they really do not need XMLDocument as a separate type AFAIK. This is why I am arguing for the DOM spec to be changed so that XMLDocument is an alias to Document. Anyway, I do not have strong feelings. I just feel it would be a cleaner situation for WebKit / Blink. |
Sure. @foolip was asking about Gecko making them aliases, though. |
Thanks @domenic, I've taken a look at those issues and virginamerica.com from 2011. The problem (from Sarissa 0.9.6.1) was This was in a non-IE codepath, "applewebkit"-sniffing actually wasn't involved here. Note that Sarissa by itself doesn't require the existence of The question then remains, does Gecko need |
I've tried to summarize everything I could find about document interfaces here: Since the discussion is spread out, I arbitrarily suggest discussing the larger issue in #221 |
I think this issue ought to be closed, because the Document constructor as already implemented returns an "xml" document, so leaving that alone seems good. One of two things can then happen:
|
I don't think this will happen. It's a compatibility nightmare for what appears to be the most marginal gain on whatever people hoped to get out of it. |
I also don't think it will happen or would be a good investment of time, just saying that closing this issue doesn't prevent it. |
Given that we seem to reach consensus in #221 let's close this in favor of that. |
The current DOM spec says "The Document() constructor, when invoked, must return a new document whose origin is the origin of current global object’s associated Document." and there's an informal note saying "Unlike createDocument(), this constructor does not return an XMLDocument object, but a document (Document object)."
However, document's type is "xml" by default. So I'm confused as to what kind of document we're creating here.
I think what we intend to say here is that we want to create a document whose type is "xml".
The text was updated successfully, but these errors were encountered: