草庐IT

Bag-of-words

全部标签

javascript - 拖动 : Replacement of the data

我得到了一个包含一些html元素的网页,其中包括一个文本区域和一个嵌入式contenteditableiframe(一个rte)。使用这段代码,我设法在主页上捕获拖动手势事件并设置文本/html数据jQuery(document).bind('draggesture',function(event){event.originalEvent.dataTransfer.setData('text/html','my_data');});现在,当拖放到主页上的文本区域时,“my_data”会被丢弃。放入contenteditableiframe也会掉落“my_data”。但是我在这里遇到了三

javascript - 在 karma 中使用 angular.mock.inject 给出 "TypeError: Cannot read property ' $injector' of null"

我正在尝试使用Karma对AngularJS进行一些基本的单元测试。我编写的所有测试在语法上似乎都是正确的。但是我在最基本的步骤中遇到了问题,即代码的beforeEach部分。当我尝试运行测试时,出现以下问题TypeError:Cannotreadproperty'$injector'ofnullatObject.workFn(http://localhost:9876/absolute/Users/vesriram/Documents/AngularJS%20project/vendor/js/angular-mocks.js:1698:15)atObject.(http://loc

javascript - FB.logout : what should it do in term of later calls to FB. getLoginStatus?

根据https://developers.facebook.com/docs/reference/javascript/FB.logout/ThemethodFB.logout()logstheuseroutofyoursite这对以后调用FB.*函数意味着什么?具体来说,我观察到即使对FB.logout的响应状态为“未知”,在注销完成后,调用FB.getLoginStatus返回状态“已连接”,当第二个参数为true时参数或页面刷新后。这对我来说是出乎意料的……也许我误解了“将用户从您的站点注销”的含义:就FB.*函数而言,这意味着什么?我希望尽可能地逆转FB.login的过程。如何

javascript - 如何使用显示 : 'auth.login' . 的 FB.ui({ 方法 : 'iframe' instead of 'popup' ? ..)

我正在为一个简单的Facebook应用开发登录功能。我能够使用JavaScriptSDK通过FB.login或以下代码在弹出窗口中成功显示登录/扩展权限对话框:FB.ui({method:'auth.login',perms:'read_stream,publish_stream',display:'popup'},function(rsp){fg_log('onlogin');if(rsp.session){if(rsp.perms){fg_log('PERMS:',rsp.perms);}else{fg_log('Hmm.Nopermissions');}}else{fg_log(

javascript - ES6 继承 : uses `super` to access the properties of the parent class

Javascript的super关键字,当我在Chrome、Babel、TypeScript上运行代码时,我得到了不同的结果。我的问题是哪个结果是正确的?规范的哪一部分定义了这种行为?以下代码:classPoint{getX(){console.log(this.x);//C}}classColorPointextendsPoint{constructor(){super();this.x=2;super.x=3;console.log(this.x)//Aconsole.log(super.x)//B}m(){this.getX()}}constcp=newColorPoint();

javascript - "WARNING - Suspicious code. The result of the ' getprop' operator is not being used."是什么意思?

"WARNING-Suspiciouscode.Theresultofthe'getprop'operatorisnotbeingused."当我使用闭包编译器时,我在我的JavaScript代码中看到了两行。它们是不报告问题的其他类型定义中的类型定义。我应该寻找什么?编辑受影响的代码:/***@typedef{{playerId:number,playerName:string,baseScores:Array.,bonusScores:Array.,*teamScoreAdjustments:Array.}}*/wias.GameTableTeamMember;/***@typed

javascript - 未捕获的类型错误 : Cannot call method 'on' of undefined - Backbone. js

我的应用程序出现错误,不知道为什么。UncaughtTypeError:Cannotcallmethod'on'ofundefined它发生在我的CollectionView上,遵循代码:App.WorkoutsView=Backbone.View.extend({initialize:function(){this.collection.on('add',this.addOne,this);this.collection.on('reset',this.addAll,this);},render:function(){this.addAll();returnthis;},addAll

javascript - jQuery Flot : Set width of chart (without labels)

有什么方法可以设置图表的实际大小(没有标签)?我有一个宽度为880像素的容器,我想让图表精确地延伸到那个宽度,并让坐标轴突出。现在当然是应用填充,以便轴可以适合指定区域。我摆弄了固定的labelWidth选项和应用于容器的负边距,但这并没有给我带来任何用处。 最佳答案 要使坐标轴突出,您可以将坐标轴(分别为y和x)的labelWidth和labelHeight设置为负值,并为容器留出边距,以便外部有足够的空间。CSS:#placeholder{border2pxsolidred;margin:30px;}float选项:varopt

javascript - Codility 训练 : Find the maximal number of clocks with hands that look identical when rotated

这是问题的链接:https://codility.com/demo/take-sample-test/clocks问题是我不能从中得到100分(只有42分)。运行时间还可以,但对于某些测试用例,代码给出了错误的答案,但我无法弄清楚问题出在哪里。有人可以帮帮我吗?这是我的代码:functionrotate(arr){varmin=arr.reduce(function(a,b){returna>b?b:a});while(arr[0]!=min){varfirst=arr.shift();arr.push(first);}}functionsolution(A,P){varpositio

javascript - 错误 : Task x can't support dependencies that is not an array of strings

我正在关注thistutorial如何开始使用gulp和browserify(以及其他插件)。结构如下:.├──gulpfile.js└──gulp  ├──index.js  └──tasks  ├──browserify.js  └──minifyCss.js/*gulpfile.js*/vargulp=require('./gulp')(['minifyCss','browserify']);gulp.task('default',['minifyCss','browserify']);/*index.js*/vargulp=require('gulp');module.expo