1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-06 03:48:28 +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 * javelin-dom
*/ */
describe('Stratcom Tests', function() { describe('Stratcom Tests', function() {
node1 = document.createElement('div'); var node1 = document.createElement('div');
JX.Stratcom.addSigil(node1, 'what'); JX.Stratcom.addSigil(node1, 'what');
node2 = document; var node2 = document;
node3 = document.createElement('div'); var node3 = document.createElement('div');
node3.className = 'what'; node3.className = 'what';
it('should disallow document', function() { 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() { it('should identify an array from another context as an array', function() {
var iframe = document.createElement('iframe'); var iframe = document.createElement('iframe');
var name = iframe.name = 'javelin-iframe-test'; iframe.name = 'javelin-iframe-test';
iframe.style.display = 'none'; iframe.style.display = 'none';
document.body.insertBefore(iframe, document.body.firstChild); document.body.insertBefore(iframe, document.body.firstChild);

View file

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

View file

@ -283,7 +283,7 @@ if (!window.console || !window.console.log) {
if (window.opera && window.opera.postError) { if (window.opera && window.opera.postError) {
window.console = {log: function(m) { window.opera.postError(m); }}; window.console = {log: function(m) { window.opera.postError(m); }};
} else { } 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. * For internal use by the Reactor system.
*/ */
_postOrder : function(node, result, pending) { _postOrder : function(node, result, pending) {
if (typeof result === "undefined") { if (typeof result === 'undefined') {
result = []; result = [];
pending = {}; pending = {};
} }

View file

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

View file

@ -121,7 +121,7 @@ JX.install('RDOM', {
if (__DEV__) { if (__DEV__) {
if (!found) { 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) { return rnode.transform(function(val) {
if (__DEV__) { if (__DEV__) {
if (!(val === true || val === false)) { 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 (__DEV__) {
if (select.value !== val) { 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); return new JX.ViewVisitor(JX.HTMLView.validate);
}, },
validate: function(view, children) { validate: function(view) {
var spec = this._getHTMLSpec(); var spec = this._getHTMLSpec();
if (!(view.getName() in spec)) { if (!(view.getName() in spec)) {
throw new Error("invalid tag"); throw new Error('invalid tag');
} }
var tag_spec = spec[view.getName()]; var tag_spec = spec[view.getName()];
@ -37,11 +37,11 @@ JX.install('HTMLView', {
var attrs = view.getAllAttributes(); var attrs = view.getAllAttributes();
for (var attr in attrs) { for (var attr in attrs) {
if (!(attr in tag_spec)) { if (!(attr in tag_spec)) {
throw new Error("invalid attr"); throw new Error('invalid attr');
} }
var validator = tag_spec[attr]; var validator = tag_spec[attr];
if (typeof validator === "function") { if (typeof validator === 'function') {
return validator(attrs[attr]); return validator(attrs[attr]);
} }
} }
@ -51,10 +51,10 @@ JX.install('HTMLView', {
_validateRel: function(target) { _validateRel: function(target) {
return target in { return target in {
"_blank": 1, '_blank': 1,
"_self": 1, '_self': 1,
"_parent": 1, '_parent': 1,
"_top": 1 '_top': 1
}; };
}, },
_getHTMLSpec: function() { _getHTMLSpec: function() {

View file

@ -56,7 +56,7 @@ JX.install('ViewInterpreter', {
if (properties instanceof JX.View || if (properties instanceof JX.View ||
properties instanceof JX.HTML || properties instanceof JX.HTML ||
properties.nodeType || properties.nodeType ||
typeof properties === "string") { typeof properties === 'string') {
children.unshift(properties); children.unshift(properties);
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() { JX.ViewPlaceholder.register(config.trigger_id, config.id, function() {
var replace = JX.$(config.id); var replace = JX.$(config.id);
var children = config.children; var children = config.children;
if (typeof children === "string") { if (typeof children === 'string') {
children = JX.$H(children); children = JX.$H(children);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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