evaluable-tag
v0.0.8
Published
The tag has evaluable attribute and it behaves like annotation to next sibling
Downloads
18
Readme
evaluable-tag
The tag has evaluable attribute and it behaves like annotation to next sibling.
install
npm install evaluable-tagusage
in browser
<script src="browser/et.js"></script>
<script>
var ET = require('evaluable-tag');
</script>in browserify
var ET = require('evaluable-tag');ET.evalBy
html
<span class="et" data-eval="1 + 2">sum</span>javascript
var evaluated = ET.evalBy('.et');
var et = evaluated[0];
console.log(et.result); // 3
console.log(et.annotation.textContent); // sum
console.log(et.annotated.textContent); // sumET.evalAnnotationsBy
html
<span class="et-a" data-eval="1 + 2">sum</span>
<div>content</div>javascript
var annotated = ET.evalAnnotationsBy('.et-a');
var et = annotated[0];
console.log(et.result); // 3
console.log(et.annotation.textContent); // sum
console.log(et.annotated.textContent); // contentThe .et-a element visibility become hidden after calling evalAnnotationsBy.
