UNPKG

inline-css

Version:
20 lines (15 loc) 472 B
'use strict'; var widthElements = [ 'table', 'td', 'img' ]; module.exports = function (el, $) { var i, pxWidth; if (widthElements.indexOf(el.name) > -1) { for (i in el.styleProps) { if (el.styleProps[i].prop === 'width' && el.styleProps[i].value.match(/px/)) { pxWidth = el.styleProps[i].value.replace('px', ''); $(el).attr('width', pxWidth); return; } } } };