UNPKG

453 BJavaScriptView Raw
1const widthElements = [ 'table', 'td', 'img' ];
2
3module.exports = (el, $) => {
4 let i;
5 let pxWidth;
6
7 if (widthElements.indexOf(el.name) > -1) {
8 for (i in el.styleProps) {
9 if (el.styleProps[i].prop === 'width' && el.styleProps[i].value.match(/px/)) {
10 pxWidth = el.styleProps[i].value.replace('px', '');
11
12 $(el).attr('width', pxWidth);
13 return;
14 }
15 }
16 }
17};