Lofesa commented on a change in pull request #1886: remove id attributes from
styles
URL:
https://github.com/apache/incubator-pagespeed-mod/pull/1886#discussion_r284160241
##########
File path: net/instaweb/rewriter/critical_css_loader.js
##########
@@ -39,12 +39,18 @@ pagespeed.CriticalCssLoader.addAllStyles = function() {
var elements = document.getElementsByClassName('psa_add_styles');
+
for (var i = 0, e; e = elements[i]; ++i) {
- if (e.nodeName != 'NOSCRIPT') { continue; }
- var div = document.createElement('div');
- div.innerHTML = e.textContent;
+ if (e.nodeName == 'NOSCRIPT') {
+ var div = document.createElement('div');
+ div.innerHTML = e.textContent;
+ var children = div.childNodes;
+ for (var v = 0; v < children.length; ++v) {
+ children[v].removeAttribute('id');
+ }
document.body.appendChild(div);
Review comment:
You are rigth, I made mistakes when correcting, sorry for that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services