Last active
December 11, 2024 01:13
-
-
Save nickytonline/8223b27b19c080c28d9f0d3b7fce1e82 to your computer and use it in GitHub Desktop.
Revisions
-
nickytonline revised this gist
Dec 10, 2024 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,10 @@ function createElement(nodeName, props) { const { style = {}, ...propsNoStyle } = props; const element = Object.assign(document.createElement(nodeName), propsNoStyle); for (const key in style) { element.style[key] = style[key]; }; return element; } -
nickytonline renamed this gist
Jul 11, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nickytonline created this gist
Jul 11, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ // Inspired from Sam Thorogood's article, https://dev.to/chromiumdev/beyond-appendchild-better-convenience-methods-for-html-55n4 function createElement(nodeName, props) { const { style = {}, ...propsNoStyle } = props; const element = Object.assign(document.createElement(nodeName), propsNoStyle); Object.entries(style).forEach(([key, value]) => { element.style[key] = value; }); return element; }