1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-28 23:48:19 +01:00

Fix various lint issues in rJX

Summary: Ref T6953.

Test Plan: `arc lint`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T6953

Differential Revision: https://secure.phabricator.com/D11376
This commit is contained in:
Joshua Spence 2015-01-14 07:59:56 +11:00
parent d0e4e96041
commit e768a633b7
20 changed files with 39 additions and 44 deletions

View file

@ -3,10 +3,10 @@
* javelin-dom
*/
describe('Stratcom Tests', function() {
node1 = document.createElement('div');
var node1 = document.createElement('div');
JX.Stratcom.addSigil(node1, 'what');
node2 = document;
node3 = document.createElement('div');
var node2 = document;
var node3 = document.createElement('div');
node3.className = 'what';
it('should disallow document', function() {

View file

@ -29,7 +29,7 @@ describe('JX.isArray', function() {
it('should identify an array from another context as an array', function() {
var iframe = document.createElement('iframe');
var name = iframe.name = 'javelin-iframe-test';
iframe.name = 'javelin-iframe-test';
iframe.style.display = 'none';
document.body.insertBefore(iframe, document.body.firstChild);

View file

@ -236,7 +236,7 @@ JX.createClass = function(junk) {
};
};
var getter = function(prop) {
return function(v) {
return function() {
return this[prop];
};
};

View file

@ -283,7 +283,7 @@ if (!window.console || !window.console.log) {
if (window.opera && window.opera.postError) {
window.console = {log: function(m) { window.opera.postError(m); }};
} else {
window.console = {log: function(m) { }};
window.console = {log: function() {}};
}
}

View file

@ -38,7 +38,7 @@ JX.install('Reactor', {
* For internal use by the Reactor system.
*/
_postOrder : function(node, result, pending) {
if (typeof result === "undefined") {
if (typeof result === 'undefined') {
result = [];
pending = {};
}

View file

@ -57,7 +57,7 @@ JX.install('ReactorNode', {
/**
* For internal use by the Reactor system
*/
getNextPulse : function(pulse) {
getNextPulse : function() {
return this._nextPulse;
},
getTransformer : function() {

View file

@ -121,7 +121,7 @@ JX.install('RDOM', {
if (__DEV__) {
if (!found) {
throw new Error("Mismatched radio button value");
throw new Error('Mismatched radio button value');
}
}
});
@ -163,7 +163,7 @@ JX.install('RDOM', {
return rnode.transform(function(val) {
if (__DEV__) {
if (!(val === true || val === false)) {
throw new Error("Send boolean values to checkboxes.");
throw new Error('Send boolean values to checkboxes.');
}
}
@ -255,7 +255,7 @@ JX.install('RDOM', {
if (__DEV__) {
if (select.value !== val) {
throw new Error("Mismatched select value");
throw new Error('Mismatched select value');
}
}
});

View file

@ -26,10 +26,10 @@ JX.install('HTMLView', {
return new JX.ViewVisitor(JX.HTMLView.validate);
},
validate: function(view, children) {
validate: function(view) {
var spec = this._getHTMLSpec();
if (!(view.getName() in spec)) {
throw new Error("invalid tag");
throw new Error('invalid tag');
}
var tag_spec = spec[view.getName()];
@ -37,11 +37,11 @@ JX.install('HTMLView', {
var attrs = view.getAllAttributes();
for (var attr in attrs) {
if (!(attr in tag_spec)) {
throw new Error("invalid attr");
throw new Error('invalid attr');
}
var validator = tag_spec[attr];
if (typeof validator === "function") {
if (typeof validator === 'function') {
return validator(attrs[attr]);
}
}
@ -51,10 +51,10 @@ JX.install('HTMLView', {
_validateRel: function(target) {
return target in {
"_blank": 1,
"_self": 1,
"_parent": 1,
"_top": 1
'_blank': 1,
'_self': 1,
'_parent': 1,
'_top': 1
};
},
_getHTMLSpec: function() {

View file

@ -56,7 +56,7 @@ JX.install('ViewInterpreter', {
if (properties instanceof JX.View ||
properties instanceof JX.HTML ||
properties.nodeType ||
typeof properties === "string") {
typeof properties === 'string') {
children.unshift(properties);
properties = {};
}

View file

@ -53,12 +53,12 @@
JX.behavior('view-placeholder', function(config, statics) {
JX.behavior('view-placeholder', function(config) {
JX.ViewPlaceholder.register(config.trigger_id, config.id, function() {
var replace = JX.$(config.id);
var children = config.children;
if (typeof children === "string") {
if (typeof children === 'string') {
children = JX.$H(children);
}

View file

@ -11,11 +11,11 @@ describe('JX.ViewRenderer', function() {
var child = new JX.View({});
var parent = new JX.View({});
parent.addChild(child);
child.render = function(_) {
child.render = function() {
child_rendered = true;
};
parent.render = function(rendered_children) {
parent.render = function() {
child_rendered_first = child_rendered;
};

View file

@ -219,7 +219,7 @@ JX.install('Leader', {
_read: function() {
var self = JX.Leader;
leader = window.localStorage.getItem(self._leaderKey) || '0:0';
var leader = window.localStorage.getItem(self._leaderKey) || '0:0';
leader = leader.split(':');
return {
@ -305,4 +305,3 @@ JX.install('Leader', {
}
});

View file

@ -39,10 +39,10 @@ JX.install('Request', {
try {
return new XMLHttpRequest();
} catch (x) {
return new ActiveXObject("Msxml2.XMLHTTP");
return new ActiveXObject('Msxml2.XMLHTTP');
}
} catch (x) {
return new ActiveXObject("Microsoft.XMLHTTP");
return new ActiveXObject('Microsoft.XMLHTTP');
}
},
@ -269,10 +269,10 @@ JX.install('Request', {
try {
if (typeof DOMParser != 'undefined') {
var parser = new DOMParser();
doc = parser.parseFromString(text, "text/xml");
doc = parser.parseFromString(text, 'text/xml');
} else { // IE
// an XDomainRequest
doc = new ActiveXObject("Microsoft.XMLDOM");
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = false;
doc.loadXML(xport.responseText);
}

View file

@ -25,7 +25,7 @@ JX.install('Resource', {
*/
load: function(list, callback) {
var resources = {},
uri, resource, path, type;
uri, resource, path;
list = JX.$AX(list);

View file

@ -107,7 +107,7 @@ JX.install('WebSocket', {
/**
* Callback for connection open.
*/
_onopen: function(e) {
_onopen: function() {
this._isOpen = true;
// Reset the reconnect delay, since we connected successfully.
@ -144,7 +144,7 @@ JX.install('WebSocket', {
/**
* Callback for connection close.
*/
_onclose: function(e) {
_onclose: function() {
this._isOpen = false;
var done = false;

View file

@ -7,7 +7,7 @@ describe('JSON', function() {
it('should encode and decode an object', function() {
var object = {
a: [0, 1, 2],
s: "Javelin Stuffs",
s: 'Javelin Stuffs',
u: '\x01',
n: 1,
f: 3.14,

View file

@ -43,7 +43,7 @@ describe('Javelin URI', function() {
});
function charRange(from, to) {
res = '';
var res = '';
for (var i = from.charCodeAt(0); i <= to.charCodeAt(0); i++) {
res += String.fromCharCode(i);
}

View file

@ -250,7 +250,6 @@ JX.install('Tokenizer', {
}
this._lastvalue = focus.value;
var root = this._root;
var metrics = JX.DOM.textMetrics(
this._focus,
'jx-tokenizer-metrics');
@ -353,9 +352,6 @@ JX.install('Tokenizer', {
},
_onkeydown : function(e) {
var focus = this._focus;
var root = this._root;
var raw = e.getRawEvent();
if (raw.ctrlKey || raw.metaKey || raw.altKey) {
return;

View file

@ -137,9 +137,9 @@ JX.install('Typeahead', {
if (__DEV__) {
if (!this._datasource) {
throw new Error(
"JX.Typeahead.start(): " +
"No datasource configured. Create a datasource and call " +
"setDatasource().");
'JX.Typeahead.start(): ' +
'No datasource configured. Create a datasource and call ' +
'setDatasource().');
}
}
this.updatePlaceholder();
@ -402,7 +402,7 @@ JX.install('Typeahead', {
this._choose(this._display[this._focus]);
return true;
} else {
result = this.invoke('query', this._control.value);
var result = this.invoke('query', this._control.value);
if (result.getPrevented()) {
return true;
}

View file

@ -147,7 +147,7 @@ JX.install('TypeaheadSource', {
this._startListener.remove();
},
didChange : function(value) {
didChange : function() {
return;
},