meter-polyfill
Polyfill for the meter element
NPM
npm install --save meter-polyfill
Bower
bower install --save meter-polyfill
test
https://fisker.github.io/meter-polyfill/test/meter/meter.html
for browsers supports meter
, use fmeter
to test
https://fisker.github.io/meter-polyfill/test/fmeter/meter.html
api
; // document contains meter; // dom contains meter; // domlist contains meter; // meter; // meters// arrays// arrays meterPolyfillversion // version numbermeterPolyfillCLASSES // class list of value elementmeterPolyfillLEVEL_SUBOPTIMUM // LEVEL_SUBOPTIMUM;meterPolyfillLEVEL_OPTIMUM // LEVEL_OPTIMUM;meterPolyfillLEVEL_SUBSUBOPTIMUM // LEVEL_SUBSUBOPTIMUM;meterPolyfillcalc // calculate meter/propValue var calcResult = meterPolyfill; // metervar calcResult = meterPolyfill; // Object propValuescalcResultmin/max/low/high/optimum/value // for browsers not support getterscalcResultpercentage // value width percentage(0-100)calcResultlevel // value level calcResultclassName // value className
usage
amd loader
known issue(s):
-
minify version does works on ie < 9
use
meter-polyfill.js
instead. until uglifyjs fix this bug -
currently firefox shows diffently from chrome
-
old IEs
-
ie <= 8 problem: accessing properties get attribute value solution: use meterPolyfill.calc(meter)[prop] instead
-
ie <= 7 problem: meter.labels is not live solution: currently no solution supplied
-
innerHTML created Meter is not polyfilled imidiately.
- call
meterPolyfill(parentNode)
manually. - render to the dom tree, it will be polyfilled.
- call
-
list functions returns diffently from native, and there is no plan to change.
-
Function.prototype.toString.call(HTMLMeterElement)
-
meter.toString()
-
Object.prototype.toString.call(meter)