mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-23 10:44:50 +00:00
Extends element widget with support for CSS custom properties (#8699)
* Extend element widget with support for CSS custom properties. * chore: added tests * chore: code style * docs: added documentation for support for CSS custom properties * docs: added documentation for support for CSS custom properties
This commit is contained in:
@@ -428,6 +428,11 @@ Widget.prototype.assignAttributes = function(domNode,options) {
|
||||
destPrefix = options.destPrefix || "",
|
||||
EVENT_ATTRIBUTE_PREFIX = "on";
|
||||
var assignAttribute = function(name,value) {
|
||||
// Process any CSS custom properties
|
||||
if(name.substr(0,2) === "--" && name.length > 2) {
|
||||
domNode.style.setProperty(name,value);
|
||||
return;
|
||||
}
|
||||
// Process any style attributes before considering sourcePrefix and destPrefix
|
||||
if(name.substr(0,6) === "style." && name.length > 6) {
|
||||
domNode.style[$tw.utils.unHyphenateCss(name.substr(6))] = value;
|
||||
|
||||
Reference in New Issue
Block a user