我认为这更像是一个 jquery 集成问题,但这是我的问题/错误。我正在尝试将 [bootstrap-tokenfield][1] 包装为聚合物元素,但出现以下错误/跟踪:
Error: An attempt was made to reference a Node in a context where it does not exist.
at GeneratedWrapper.mixin.insertBefore (http://localhost:3005/ShadowDOM/src/wrappers/Node.js:266:30)
at Object.<anonymous> (http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js:6067:21)
at jQuery.fn.extend.domManip (http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js:6262:15)
at jQuery.fn.extend.before (http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js:6065:15)
at Tokenfield.createToken (http://localhost:3005/elements/ui-widgets/bootstrap-tokenfield/bootstrap-tokenfield.js:175:21)
编码:
<polymer-element name="my-bootstrap-tokenfield">
<template>
<link rel="stylesheet" href="bootstrap-tokenfield.css">
<input type="text" class="form-control" id="tokenfield" value="red,green,blue" />
</template>
<script src="bootstrap-tokenfield.js"></script>
<script>
Polymer('my-bootstrap-tokenfield', {
applyAuthorStyles : true,
ready : function() {
// default example
$(this.$.tokenfield).tokenfield({
typeahead: {
name: 'tags',
local: ['red','blue','green','yellow','violet','brown','purple','black','white'],
},
allowDuplicates: true
});
}
})
</script>
</polymer-element>
想法、建议?