mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Extend domMaker to set event listeners
This commit is contained in:
parent
f8f524d378
commit
b474d8c13d
@ -114,6 +114,7 @@ children: array of further child nodes
|
||||
innerHTML: optional HTML for element
|
||||
class: class name(s)
|
||||
document: defaults to current document
|
||||
eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded)
|
||||
*/
|
||||
$tw.utils.domMaker = function(tag,options) {
|
||||
var doc = options.document || document;
|
||||
@ -133,6 +134,9 @@ $tw.utils.domMaker = function(tag,options) {
|
||||
$tw.utils.each(options.attributes,function(attribute,name) {
|
||||
element.setAttribute(name,attribute);
|
||||
});
|
||||
if(options.eventListeners) {
|
||||
$tw.utils.addEventListeners(element,options.eventListeners);
|
||||
}
|
||||
return element;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user