CSS errors in AMP
I am developing the AMP pages of our site. When I see the console, there are several css errors, and one JS error. Here are the log:
Error in parsing value for 'align-items'. Declaration dropped. amp:108:140
Error in parsing value for 'box-sizing'. Declaration dropped. amp:110:110
Unknown property 'margin-legt'. Declaration dropped. amp:110:126
Powered by AMP ⚡ HTML – Version 1448058695548 v0.js:23:12712
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create v0.js:1:25374
Error in parsing value for '-moz-text-size-adjust'. Declaration dropped. amp:1:76
Unknown property 'text-size-adjust'. Declaration dropped. amp:1:123
AMP validation successful. validator.js:212:62
@powdercloud Do we check for CSS property names? I didn't realize we did that. I don't think we should. Please advise.
@vaso123 would you mind posting fragments of your CSS around the listed lines? I can't reproduce these errors. And also please include the browser type and version where you are seeing this.
This doesn't sound like it's the validator emitting these errors. Those aren't errors the validator can produce, and the validator reports validation successful which would only happen if it didn't find any errors. They also appear before the AMP output, could these be the browser emitting errors?
Thanks, Greg! In this case we definitely need to know browser info. On Nov 27, 2015 11:59 AM, "Greg Grothaus" [email protected] wrote:
This doesn't sound like it's the validator emitting these errors. Those aren't errors the validator can produce, and the validator reports validation successful which would only happen if it didn't find any errors. They also appear before the AMP output, could these be the browser emitting errors?
— Reply to this email directly or view it on GitHub https://github.com/ampproject/amphtml/issues/1020#issuecomment-160197124 .
You received this message because you are subscribed to the Google Groups "amphtml-eng-github" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/amphtml-eng-github/ampproject/amphtml/issues/1020/160197124%40github.com https://groups.google.com/a/google.com/d/msgid/amphtml-eng-github/ampproject/amphtml/issues/1020/160197124%40github.com?utm_medium=email&utm_source=footer .
You received this message because you are subscribed to the Google Groups "amphtml-eng" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/google.com/d/msgid/amphtml-eng/ampproject/amphtml/issues/1020/160197124%40github.com https://groups.google.com/a/google.com/d/msgid/amphtml-eng/ampproject/amphtml/issues/1020/160197124%40github.com?utm_medium=email&utm_source=footer .
Perhaps these errors come from Firefox, the Firefox dev tools or some plugin, possibly at older versions. E.g. https://github.com/mbostock/d3/issues/1805 http://stackoverflow.com/questions/4707747/how-to-prevent-css-declaration-dropped-errors-cross-browser @vaso123 I think you should check for the plugins / addons / etc. that you're running. Make sure they're up to date, or disable them, and use a recent browser. I'm saying this because align-items seems like a legit property, but hasn't been supported forever by everything (https://developer.mozilla.org/en-US/docs/Web/CSS/align-items).
This sounds like the cause. We send both vendor prefixed and unprefixed properties. On Nov 27, 2015 6:36 PM, "Johannes Henkel" [email protected] wrote:
Perhaps these errors come from Firefox, the Firefox dev tools or some plugin, possibly at older versions. E.g. mbostock/d3#1805 https://github.com/mbostock/d3/issues/1805
http://stackoverflow.com/questions/4707747/how-to-prevent-css-declaration-dropped-errors-cross-browser @vaso123 https://github.com/vaso123 I think you should check for the plugins / addons / etc. that you're running. Make sure they're up to date, or disable them, and use a recent browser. I'm saying this because align-items seems like a legit property, but hasn't been supported forever by everything ( https://developer.mozilla.org/en-US/docs/Web/CSS/align-items).
— Reply to this email directly or view it on GitHub https://github.com/ampproject/amphtml/issues/1020#issuecomment-160242108 .
This is a Firefox Developer Edition, 44.0a2 (2015-11-26)
I will check it in safe mode too.
You were right guys, the first 3 errors was my fault. Now I fixed them, and restart firefox in safe mode:
Powered by AMP ⚡ HTML – Version 1448058695548 v0.js:23:12712
mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create v0.js:1:25374
Error in parsing value for '-moz-text-size-adjust'. Declaration dropped. amp:1:76
Unknown property 'text-size-adjust'. Declaration dropped. amp:1:123
AMP validation successful. validator.js:212:62
I have no properties like these: -moz-text-size-adjust, text-size-adjust
Maybe this is the firefox developer version thing, the CSS errors. But what about the JS error?
@erwinmombay could you please take a look and respond? It's a warning in Firefox on setting prototype and it happens here:
var useNative = function(){
var works = false;
function P2(x){
var self = new P(x);
setProto(self, P2.prototype);
return self;
}
try {
works = P && P.resolve && testResolve();
setProto(P2, P);
P2.prototype = $.create(P.prototype, {constructor: {value: P2}});
// actual Firefox has broken subclass support, test that
if(!(P2.resolve(5).then(function(){}) instanceof P2)){
works = false;
}
@erwinmombay Can you take a fresh look?
@rudygalfi looking.
@dvoytenko so that code looks like its in core-js which we can probably get rid of when we use @jridgewell Promise polyfill.
We'll still need some feature detecting in my polyfill, but we can probably get away with:
var works = false;
function SubClass() {}
SubClass.prototype = Object.create(Promise.prototype);
SubClass.prototype.constructor = SubClass;
SubClass.resolve = Promise.resolve;
try {
var p = Subclass.resolve(5).then(function() {});
works = p instanceOf SubClass;
} catch (e) {}
//...
Is this still relevant?
Nope, we migrated to my Promise polyfill.