* Reconstructs the string expression for this srcset. * @param {function(string):string=} opt_mapper * @return {string}
(opt_mapper)
| 229 | * @return {string} |
| 230 | */ |
| 231 | stringify(opt_mapper) { |
| 232 | const res = []; |
| 233 | const sources = this.sources_; |
| 234 | for (let i = 0; i < sources.length; i++) { |
| 235 | const source = sources[i]; |
| 236 | let src = source.url; |
| 237 | if (opt_mapper) { |
| 238 | src = opt_mapper(src); |
| 239 | } |
| 240 | if (this.widthBased_) { |
| 241 | src += ` ${/** @type {WidthSourceDef} */ (source).width}w`; |
| 242 | } else { |
| 243 | src += ` ${/** @type {DprSourceDef} */ (source).dpr}x`; |
| 244 | } |
| 245 | res.push(src); |
| 246 | } |
| 247 | return res.join(', '); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
no test coverage detected