ele.setAttribute( '@example', 'foo')
(Extension designed to work with any JS framework.)
setattribute-extended is a JavaScript monkey patch that allows the DOM setAttribute† function to correctly create "extended" attribute names. (e.g. &click) Without it, extended characters cannot be set in attribute names. Attribute names (by default) are limited to
RegExp ```
/^[a-z0-9-_:.]+$/i
There is a cost. Extended names
are slower to set than plain names...
(the code uses three DOM level 1 methods). Therefore, the slower, extended algorithm is
applied only to names with special characters</u>.
† The original function is still available as ```_setAttribute( )```
## Usage
npm install --save vue-setattribute-extended
Just load the script and **setAttribute** is extended thereafter.
import 'vue-setattribute-extended'
The browser's, (and hence Vue's), <b>setAttribute</b> method will be monkey-patched the instant main.js is loaded into the browser. The patch is transparent to any application/DOM usage, as well as for Vue.
This extended setAttribute code patch will persist <u>throughout the duration of your app's execution;</u> and the browser will simply discard it when the next page is loaded.
## test
cd test open test.html
// setAttributeExtended passes 4 tests OK