KOSASIH / SilkRoad

Use $document instead of document JS-0555
Anti-pattern
Minor
8 months agoa year old
You should use the $document service instead of the default document object
3171	
3172			$(window).off(eventNS);
3173			$(document).off(eventNS);
3174			$(document.body).off(eventNS);3175	
3176			delete self.$input[0].selectize;
3177		},
You should use the $document service instead of the default document object
2227				if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
2228					// render the optgroup header and options within it,
2229					// then pass it to the wrapper template
2230					html_children = document.createDocumentFragment();2231					html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));
2232					html_children.appendChild(groups[optgroup]);
2233	
You should use the $document service instead of the default document object
2221			}
2222	
2223			// render optgroup headers & join groups
2224			html = document.createDocumentFragment();2225			for (i = 0, n = groups_order.length; i < n; i++) {
2226				optgroup = groups_order[i];
2227				if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
You should use the $document service instead of the default document object
2204						optgroup = '';
2205					}
2206					if (!groups.hasOwnProperty(optgroup)) {
2207						groups[optgroup] = document.createDocumentFragment();2208						groups_order.push(optgroup);
2209					}
2210					groups[optgroup].appendChild(option_html);
You should use the $document service instead of the default document object
1750	
1751			if (self.ignoreFocus) {
1752				return;
1753			} else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {1754				// necessary to prevent IE closing the dropdown when the scrollbar is clicked
1755				self.ignoreBlur = true;
1756				self.onFocus(e);