Skip to content
Snippets Groups Projects
Commit a3d93c6f authored by Arkerthan's avatar Arkerthan
Browse files

Add pure DOM passage

parent f4f510c9
No related branches found
No related tags found
1 merge request!8501Add a pure DOM passage
/**
* A pure DOM Passage, the SugarCube Wikifier never gets invoked.
*/
App.DomPassage = class extends Passage {
/**
* @param {string} title
* @param {function():DocumentFragment|function():HTMLElement} callback
* @param {string[]} tags
*/
constructor(title, callback, tags = []) {
super(title, {
hasAttribute: a => a === "tags",
getAttribute: () => tags.join(" ")
});
this.callback = callback;
Story.add(this);
}
/**
* @returns {DocumentFragment|HTMLElement}
*/
render() {
return this.callback();
}
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment