草庐IT

and-write-xml-documents-with-gdat

全部标签

javascript - ((?:[^\"])*) and ([^\"]*) 之间的正则表达式差异

这个正则表达式是可替换的有什么区别?((?:[^\"])*)([^\"]*)这个问题的背景:javascript所见即所得编辑器(tinymce)无法解析我的html代码在Firefox(23.0.1和25.0a2)中,但在Chrome中工作。我发现正则表达式是罪魁祸首:attrRegExp=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;我修改,替换((?:[^\"])*)与([^\"]*)和((?:[^\'])*)与([^\']*)生成的正则表达式在我的测试用例的两个浏

javascript - 未捕获的类型错误 : Cannot read property 'lat' of undefined when serializing leaflet data with $. 参数()

我想先说明一下:我是JavaScript的新手。我正在尝试使用Leaflet和AJAX调用发布用户位置和map边界。在我的事件处理程序stateUpdater.onLocationFound中,日志语句打印出正确的用户坐标和map边界,但是我在尝试时得到UncaughtTypeError:Cannotreadproperty'lat'ofundefined使用$.param()序列化这些值。我正在使用Leafletv0.7.2和jQuery1.11.0。varmap;$(document).ready(function(){map=newL.map('map').setView([41

javascript - 用户界面路由器 : open modal and pass parent scope parameters to it

我正在使用这个FAQ条目在某个状态的子状态中打开模式对话框:https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-open-a-dialogmodal-at-a-certain-state我的代码如下。当我打开模式对话框时,我需要访问父状态范围的属性。这可能吗?plnkr:http://plnkr.co/edit/knY87n.state('edit',{url:'/{id:[0-9a-f]+}',views:{'@':{templateUrl:'views/edit.html',c

Javascript错误 : javascript error: document unloaded while waiting for result

在使用Protractor端到端测试运行测试Angular应用时。我目前正面临一个问题。这是一个间歇性问题。我收到“JavascriptError:javascripterror:documentunloadedwhilewaitingresult”。日志如下:Failures:[18:51:46][Step4/4]1)vacanciesshouldcreatenewjoblisting[18:51:46][Step4/4]Message:[18:51:46][Step4/4][31mFailed:javascripterror:documentunloadedwhilewaiting

javascript - 新的 Typeahead with Bloodhound 如何处理错误?

我遇到一个问题,当用户联合session到期时,Typeahead就停止工作了。我希望能够在Typeahead的“远程”调用失败时执行操作。特别是Typeahead是如何处理的?是否存在某种类似于您在典型的ajax调用中发现的“错误”回调?这是我目前拥有的代码:varhints=newBloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:"/ProjectAssociation

javascript - Angular 2 : oauth2 with token headers

我是angular2的新手。在1.*中,拦截器一切正常,只需添加它们:你的header无处不在,当token无效时,你可以处理你的请求......在angular2中,我使用的是RxJs。所以我得到了我的token:getToken(login:string,pwd:string):Observable{letbodyParams={grant_type:'password',client_id:'admin',scope:AppConst.CLIENT_SCOPE,username:login,password:pwd};letparams=newURLSearchParams();

javascript - ES6 模块 : Exporting and importing performance differences

我的vue项目中有一些组件。我不喜欢importloaderfrom'@/components/someComponent1/someComponent1.vue';因为要写的东西很多而且我必须为每个组件重复一遍。所以我为components文件夹写了一个index.js:export{defaultassomeComponent1}from'./someComponent1/someComponent1.vue';export{defaultassomeComponent2}from'./someComponent2/someComponent2.vue';...这将允许我在一行中导

javascript - VueJS : input with dynamic value + v-model

在设置输入radio和v模型的值时,我遇到了VueJS问题。我不明白为什么我不能为输入动态设置值并使用模型来检索用户选择的输入。在代码中更容易理解:exportdefault{props:["question","currentQuestion"],data(){return{answer:undefined}},computed:{isCurrent(){returnthis.currentQuestion&&this.currentQuestion.id==this.question.id;}},methods:{groupName(question){return'questio

javascript - 云函数 : How to copy Firestore Collection to a new document?

我想在发生事件时使用CloudFunctions在Firestore中制作一个集合的副本我已经有了迭代集合并复制每个文档的代码constfirestore=admin.firestore()firestore.collection("products").get().then(query=>{query.forEach(function(doc){varpromise=firestore.collection(uid).doc(doc.data().barcode).set(doc.data());});});有更短的版本吗?一次复制整个集合? 最佳答案

javascript - D3 : zoom to bounding box with d3-tiles

我已经成功地将D3(矢量)map分层放置在从Mapbox中提取图block的d3-tile(光栅)map之上。手动缩放效果完美,矢量和光栅同步。我现在正在尝试实现MikeBostock'zoom-to-bounding-box'功能,应用程序可在用户单击时放大所需的国家/地区。我想我快到了,但现在似乎不匹配,可以这么说,map缩小到外太空。我在这个jsfiddle中重现了这个问题.我需要在“缩放”功能中进行哪些修改才能使map按预期正确缩放?我认为这就是问题所在:vector.selectAll("path").attr("transform","translate("+[transf