-
Notifications
You must be signed in to change notification settings - Fork 4
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
CSS Parsing errors are not shown to the user #5
Comments
Thanks for digging into the issue. The reason NV/CSSOM is currently used, is a bug in Chrome (https://code.google.com/p/chromium/issues/detail?id=161644). This might or might not have been fixed. In case you don't need the respective feature, or target other browsers, you should be able to take out CSSOM of the package, and the code will fallback to the browser's own CSSOM implementation. |
Thanks for the tip on disabling CSSOM. I hadn't realized it would work without it. It actually fixes a rendering issue I had with some gnarly relative positioning, although only in chrome canary; not Chrome stable or Firefox developer edition. |
I'd like to continue ship CSSOM in the allinone build by default, as the Chrome bug fails a basic feature here. Let's hope CSSOM catches up with the newest CSS features. |
But yes, we should make the error reporting better here. The parsing error should be reported. |
I am trying to make the method fail, but can't. Do you have a short example? I believe it is one of the steps in https://github.com/cburgmer/inlineresources/blob/master/src/inline.js#L118 that is failing. |
From memory:
Also, HTML parsing errors. E.g.: (I cut & pasted HTML into a test where our server framework had failed to render a tag.) I'll check on Monday if there was anything else I has to fix in my code to get the test to run. |
The HTML I can directly reproduce. The @page rule, I cannot, using rasterizeHTML.js/examples/index.html (and the dev console open). Do send me a full example once you have it. As for the HTML tag issue, I don't have an initial guess where this is happening - it is interesting to see though that there's no direct stack trace. |
I can tell you where the HTML issue is on Monday when I'm back to work.
|
looks like the CSS issue may have been relative paths to non-existant images in backround urls. I think |
the html errors are in |
I'd forgot to turn CSSOM back on. Here's a testcase:
|
On the HTML error in rasterizeHTML: This is a limitation, which I've actually documented in the past (should've thought of that earlier). See the last point under https://github.com/cburgmer/rasterizeHTML.js/wiki/Limitations. The issue is simple: To render any HTML, it needs to be rewritten as valid XML, but the XMLSerializer does not know what to do with those tags, as they are invalid XML as long as now namespace is declared (which could be a temporary work around for you). If you have an idea how to fix this or a certain expectation on what it should do instead, do open a ticker with rasterizeHTML and we can discuss there. |
Thanks for the test case. I was testing in the wrong browser, and so cssom was never loaded. For me the error is thrown and visible in the console, and it is unclear to me, why the error is not captured in the promise chain, and properly reported. However, even if this reporting issue got fixed, we are talking about a non-standard behaviour of the CSS parsing drop-in, as the default behaviour of the browser's seems to be to ignore any invalid CSS and keep on parsing. The proper solution to this problem to me seems to make Chrome fix the original issue the workaround was implemented for. |
I was trying to create a testcase for our app's currect CSS and so I just Someone else might have concluded that csscritic didn't work and given up If the errors are reported it allows users to fix their code and get a
|
I think it should be feasible to catch the error, and record properly. The only issue is though, that it's hard to log the point of the actual failure. I feel JavaScript's error reporting is not making it easy to handle such things across browsers well. I might find time to look into this, but I'll be happy for any help on this :) |
I've got my css working for now but I'll probably come across it again soon. I'll make a PR if I can work out a way to get the details of the error. |
I've raised a separate issue for the HTML errors: cburgmer/csscritic#65 |
Trying to summarise this ticket:
I'd like to tackle
Do you think it is OK to close this issue? |
Yep. That sums it up. Ok to close. Good that chrome team picked up that bug.
|
Thanks for prodding the Chrome guys. Helped a lot :) |
I get the
Unable to load stylesheet undefined
with some third party css that uses an @page rule.The parsing error is an issue with the parser library you're using (NV/CSSOM#5) but not showing the user that there was an error with the parsing is non-helpful.
To be able to see where the error was I edited
rasterizeHTML.allinone.js
to use the following code:The text was updated successfully, but these errors were encountered: