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

HTML: test stylesheet loading text/css requirement #13144

Merged
merged 5 commits into from
Sep 26, 2018

Conversation

annevk
Copy link
Member

@annevk annevk commented Sep 21, 2018

No description provided.

@annevk
Copy link
Member Author

annevk commented Sep 21, 2018

I wrote this for https://bugzilla.mozilla.org/show_bug.cgi?id=562377. It seems this could use some cleanup in HTML as well around the requirements.

@annevk
Copy link
Member Author

annevk commented Sep 21, 2018

(I would have thought we test this elsewhere too, but I couldn't find anything quickly.)

@annevk
Copy link
Member Author

annevk commented Sep 22, 2018

@zcorpan thanks, do you happen to know if we have quirks tests for this? If not, I'll add more tests Monday or so.

@@ -44,5 +45,44 @@
elt.rel = "stylesheet";
elt.href = "../../../../../common/css-red.txt";
document.getElementsByTagName("head")[0].appendChild(elt);
})
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Would you be up for adding semicolons above as well to match here, and maybe use t.step_func_done() in the above preexisting tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try not to make stylistic changes at the same time as that messes with blame too much in my opinion. And then doing it as a separate commit often seems like too much effort... I might not be making the right tradeoffs though.

@zcorpan
Copy link
Member

zcorpan commented Sep 23, 2018

I don't know, but suspect we don't have that.

@annevk
Copy link
Member Author

annevk commented Sep 24, 2018

I added tests for quirks and limited quirks. It seems Chrome and Safari are more relaxed when it comes to style sheet loading. I'll file bugs.

@annevk
Copy link
Member Author

annevk commented Sep 24, 2018

And wow, Edge is even worse...

@annevk
Copy link
Member Author

annevk commented Sep 24, 2018

whatwg/html#3457 is probably the best HTML Standard issue to track improvements at.

@annevk
Copy link
Member Author

annevk commented Sep 24, 2018

I don't think we should block landing this on those happening though.

@gsnedders
Copy link
Member

"limitedd" (in the commit message) isn't how you spell limited. :)

Also: 🎉 for having tests for this.

@@ -0,0 +1,48 @@
<!DOCTYPE HTML PUBLIC "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//" "">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace this with a comment saying "quirks mode"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot less fun.

[
["same-origin", "resources/css.py"],
["cross-origin", get_host_info().HTTP_REMOTE_ORIGIN + "/html/semantics/document-metadata/the-link-element/resources/css.py"]
].forEach(originType => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please deduplicate the code by moving it into a separate JS file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's reasonable. Do you think it's fine to make it depend on document.compatMode or do you think it should be something you call externally?

The other thing I was thinking of also testing is @import, but how that affects load/error events isn't really defined yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using document.compatMode should be fine.

@annevk
Copy link
Member Author

annevk commented Sep 25, 2018

Thanks @zcorpan. I might wait a bit for @bzbarsky to take a look if he wants, since I'm not entirely sure about the @import stuff, but if that doesn't come to pass I need to at least file bugs.

@bzbarsky
Copy link
Contributor

The test is loading urls like "resources/css.py...." from a sheet that's loaded from a data: URL. Those relative URIs are resolved relative to the data: URL, which fails, so the load is not performed at all. Whether this should trigger the error event is an interesting question, but at the moment the test is not testing what it thinks it's testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants