我想不出如何找回当前的攻击。输入类型范围元素的值。攻击者。值似乎不是幻灯片期间更改的“内部吸引值”。
Javascript
'use-strict';
(function(){
var fooProt = Object.create(HTMLElement.prototype);
Object.defineProperty(fooProt, "bar", {
value: {test: 1},
writable: false,
enumerable: true
});
fooProt.getMin = function() {
return this.bar.test;
};
fooProt.attachedCallback = function () {
this.addEventListener('change', function(){
//get current value, following does not appear to work
//console.log(this.value);
});
};
var foo = document.registerElement('ex-foo', {prototype : fooProt, extends : 'input'});
})();<input type="range" min="1" max="100" value="1" is="ex-foo" id="foo">发布于 2015-06-16 00:21:37
HTMLElement不为您提供value属性,但HTMLInputElement提供:
var fooProt = Object.create(HTMLInputElement.prototype);https://stackoverflow.com/questions/30856867
复制相似问题