草庐IT

execute-attribute

全部标签

javascript - 无法使用 polymer 元素 - "Failed to execute ' registerElement' on 'Document' "

我创建了一个元素,为简洁起见,我将在此处对其进行简化,我想执行一个端到端的流程,看看它是否有效。这是它的bower.json文件:{"name":"test-element","version":"0.0.1","authors":["myname"],"description":"Adescription","license":"MIT","ignore":["**/.*","node_modules","bower_components","test","tests"],"dependencies":{"polymer":"~0.9.0"}}我将它上传到我的测试仓库,并在WebSt

javascript - jquery属性选择器问题: Dynamic attribute selector

我的代码在这里$("a[href=$.jqURL.url()]").hide();$.jqURL.url()返回当前页面url。但是这段代码不起作用是否可以动态选择? 最佳答案 您需要将选择器构建为字符串:$("a[href="+$.jqURL.url()+"]").hide(); 关于javascript-jquery属性选择器问题:Dynamicattributeselector,我们在StackOverflow上找到一个类似的问题: https://st

javascript - 需要模式 : create new object that returns an executeable function and inherits from a prototype

场景1-一切正常:varAwesomeObject=function(){varself=this;self.whatstuff='reallyawesome';}AwesomeObject.prototype.doStuff=function(){varself=this;console.log('idid'+self.whatstuff+'stuff');returnself;}varawesome=newAwesomeObject();//returnsanewAwesomeObjectawesome.doStuff();//prints'ididreallyawesomestu

javascript - Rails Assets 管道 : JavaScript being executed twice

我的JavaScript被执行了两次。当我运行Chrome调试器时,我注意到单个JavaScript文件将首先执行代码,然后application.js文件将再次执行代码。我相信这是因为我最近关闭了预编译,因为我在使用Heroku时遇到了问题。在此之后,我运行了rakeassets:precompile。 最佳答案 涡轮链接您可能对Turbolinks有疑问(考虑到您已将其包含在您的Assets管道中);虽然这可能不是问题。Turbolinks旨在通过加载来加快您的页面加载时间。使用ajax标记您的新页面,保持标签完好无损。这是为了

javascript - Chrome 扩展 : How to reload/re-execute content script on Ajax request

我正在尝试为某个网站执行内容脚本(插入按钮或更改链接),但我想在用户浏览网站时执行此操作。问题在于网页是在用户浏览时使用ajax请求动态构建的。我之前在编写的扩展程序中解决了这个问题,方法是将我的JavaScript实际注入(inject)到网页中。我想知道是否有更好的选择,除了能够在我的内容脚本中注册一个ajaxComplete事件或类似的东西,以便我可以重新执行。我可以做以下事情:functionlistener(){console.debug("listenerfired.");}document.addEventListener("DOMSubtreeModified",lis

javascript - Sequelize 更新不再起作用 : "Missing where attribute in the options parameter passed to update"

TheofficialAPIdocumentation建议像这样使用Model.update:vargid=...;varuid=...;varvalues={gid:gid};varwhere={uid:uid};myModel.update(values,where).then(function(){//updatecallback});但这给了我:“传递给更新的选项参数中缺少where属性”。文档还提到这种用法已被弃用。看到这个错误让我想,他们已经改变了它。我做错了什么? 最佳答案 显然,文档还没有更新。但是表的where行t

javascript - 未捕获的 InvalidStateError : Failed to execute 'transaction' on 'IDBDatabase' : A version change transaction is running

我必须承认我是indexedDB的新手我写了一段indexedDB的简单代码,如下:functiongo(){varreq=window.indexedDB.open("Uploader",1),db;req.onerror=function(e){console.log("Error");};req.onsuccess=function(e){db=e.target.result;};req.onupgradeneeded=function(e){console.log(db);db=e.target.result;varos=db.createObjectStore("Files"

javascript - Angular : src attribute bug in Iframe directive

我在尝试实现Iframe指令时遇到问题。就我而言:模板:指令:angular.module('project.directives',[]).directive('externalIframe',['$rootScope',function($rootScope){return{restrict:'C',replace:true,transclude:true,scope:{src:'@iframeSrc',//thesrcusesthedata-bindingfromtheparentscope},template:'',link:function(scope,elem,attrs)

javascript - JS (ES6) : Filter array based on nested array attributes

我有一个数组,看起来像这样:constpersons=[{name:"Joe",animals:[{species:"dog",name:"Bolt"},{species:"cat",name:"Billy"},]},{name:"Bob",animals:[{species:"dog",name:"Snoopy"}]}];现在我想根据物种进行过滤。例如:每个养猫的人,都应该返回:constresult=[{name:"Joe",animals:[{species:"dog",name:"Bolt"},{species:"cat",name:"Billy"},]}];我试过这样的fil

javascript - 如何解决来自 YouTube 嵌入的 'Failed to execute ' postMessage' on 'DOMWindow' ' 错误

我尝试使用YouTubeJavaScript/iFrameAPI寻找视频的不同时间。我已经精简了一个演示:http://jsbin.com/yuliponuvarplayer;window.onYouTubeIframeAPIReady=function(){variframe=document.createElement("iframe");iframe.width=400;iframe.height=300;iframe.id="youtubeIframe";iframe.src="https://www.youtube.com/embed/yta1WRuiupk?autoplay