Skip to content

HTML: test stylesheet loading text/css requirement - #13144

Merged
annevk merged 5 commits into
masterfrom
annevk/stylesheet-loading
Sep 26, 2018
Merged

annevk merged 5 commits into
masterfrom
annevk/stylesheet-loading

Conversation

@annevk

@annevk annevk commented Sep 21, 2018

Copy link
Copy Markdown
Member

No description provided.

@annevk

annevk commented Sep 21, 2018

Copy link
Copy Markdown
Member Author

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

annevk commented Sep 21, 2018

Copy link
Copy Markdown
Member Author

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

@annevk

annevk commented Sep 22, 2018

Copy link
Copy Markdown
Member Author

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

elt.href = "../../../../../common/css-red.txt";
document.getElementsByTagName("head")[0].appendChild(elt);
})
});

Copy link
Copy Markdown
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
Copy Markdown
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

zcorpan commented Sep 23, 2018

Copy link
Copy Markdown
Member

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

@annevk

annevk commented Sep 24, 2018

Copy link
Copy Markdown
Member Author

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

annevk commented Sep 24, 2018

Copy link
Copy Markdown
Member Author

And wow, Edge is even worse...

@annevk

annevk commented Sep 24, 2018

Copy link
Copy Markdown
Member Author

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

@annevk

annevk commented Sep 24, 2018

Copy link
Copy Markdown
Member Author

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

@gsnedders

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

annevk commented Sep 25, 2018

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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