Hi to all
As @oschaaf seguested I send this to the dev list.
Digiing in the code I found that in
archive net/instaweb/rewriter/image_rewrite_filter.cc lines 2141 - 2146
have a if statement to test HtmlName::kImg and a test to check if
HtmlName::kSrcset
is present.
This make that other attributes like data-srcset can“t be
rewrited/optimized by pagespeed.
I make a test, and it is working getting data-srcset optimized.
1.- Insert  kDataSrcset,   in pagespeed/kernel/html/html_name.h as line 105
2.- Insert  "data-srcset", HtmlName::kDataSrcset
in pagespeed/kernel/html/html_name.gperf as line 129
3.- Chenged lines 2141-22146 in the file
net/instaweb/rewriter/image_rewrite_filter.cc
lines with

2141  if (element->keyword() == HtmlName::kImg) {
    HtmlElement::Attribute* srcset =
element->FindAttribute(HtmlName::kSrcset);
    HtmlElement::Attribute* datasrcset =
element->FindAttribute(HtmlName::kDataSrcset);
    if (srcset != nullptr) {
      BeginRewriteSrcSet(element, srcset);
    }
    if (datasrcset != nullptr) {
        srcset = datasrcset ;
        BeginRewriteSrcSet(element, srcset);
    }

  }

This work, data-srcset attributes are rewrited/optimized, but for sure is
not the best way to do as far as i not a developer.

Any thougths?

Thx in advance

Reply via email to