buildInlineStyle static method
Implementation
static CSSStyle? buildInlineStyle(Element element) {
List<CSSProperty> cssProperties = [];
String cssText = '';
element.inlineStyle.forEach((key, value) {
String kebabName = _kebabize(key);
String propertyValue = value.toString();
String _cssText = '$kebabName: $propertyValue';
CSSProperty cssProperty = CSSProperty(
name: kebabName,
value: value,
range: SourceRange(
startLine: 0,
startColumn: cssText.length,
endLine: 0,
endColumn: cssText.length + _cssText.length + 1,
),
);
cssText += '$_cssText; ';
cssProperties.add(cssProperty);
});
return CSSStyle(
// Absent for user agent stylesheet and user-specified stylesheet rules.
// Use hash code id to identity which element the rule belongs to.
styleSheetId: element.ownerDocument.controller.view.getTargetIdByEventTarget(element),
cssProperties: cssProperties,
shorthandEntries: <ShorthandEntry>[],
cssText: cssText,
range: SourceRange(startLine: 0, startColumn: 0, endLine: 0, endColumn: cssText.length)
);
}