This file contains 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 characters
/** | |
* Helpers for Flarum | |
* | |
* Allows you to do the following | |
* setDeep(vdom, 'attrs.style.borderColor', '#f00') | |
* mergeDeep(this.props, {className: 'Class', params: {q: null}}) | |
*/ | |
// https://stackoverflow.com/questions/27936772/how-to-deep-merge-instead-of-shallow-merge | |
/** |
This file contains 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 characters
/** | |
* // Desired usage: | |
* import vdom from 'flarum/helpers/vdom'; | |
* import {find, vdom} from 'flarum/helpers/vdom'; | |
* | |
* // Supports tagname, class and id selectors | |
* vdom('.container ul#logo li.item.item-one a') // Returns array of vnodes | |
* find('.username') // Returns array of objects containing the vnode and more information {vnode, parent, index} | |
* | |
* // Example: |