1
0
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:
Saq Imtiaz
2024-10-29 12:59:04 +01:00
committed by GitHub
parent 8b9723f6c7
commit a687aefbe9
4 changed files with 76 additions and 30 deletions

View File

@@ -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;