扫一扫分享
SentinelJS is a tiny JavaScript library that makes it easy to set up a watch function that will notify you anytime a new node is added to the dom that matches a given css rule. Among other things, you can take advantage of this to implement custom-elements and make other in-place modifications to new DOM elements:
<script>
sentinel.on('custom-element', function(el) {
// A new <custom-element> has been detected
el.innerhtml = 'The sentinel is always watching.';
});
</script>
<custom-element></custom-element>
仅供个人学习参考/导航指引使用,具体请以第三方网站说明为准,本站不提供任何专业建议。如果地址失效或描述有误,请联系站长反馈~感谢您的理解与支持!
手机预览