tag-search
Version:
search and list html tags like named anchor links
1,786 lines (1,536 loc) • 1.35 MB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var _createClass = (function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
})();
var _get = function get(_x, _x2, _x3) {
var _again = true;_function: while (_again) {
var object = _x,
property = _x2,
receiver = _x3;desc = parent = getter = undefined;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
var parent = Object.getPrototypeOf(object);if (parent === null) {
return undefined;
} else {
_x = parent;_x2 = property;_x3 = receiver;_again = true;continue _function;
}
} else if ('value' in desc) {
return desc.value;
} else {
var getter = desc.get;if (getter === undefined) {
return undefined;
}return getter.call(receiver);
}
}
};
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactDom = require('react-dom');
var _libTagSearchJs = require('../../lib/tag-search.js');
var _libTagSearchJs2 = _interopRequireDefault(_libTagSearchJs);
var anchorOpts = {
useLocation: false,
nostyles: false,
noclasses: false,
searchBar: 'searchBar',
searchList: 'searchList',
tagSelector: 'a[name]',
wrapperLeftText: 'click for menu',
wrapperRightText: 'click to search',
styles: {
'searchBar': {
'height': '50px',
'width': '100%',
'position': 'fixed',
'bottom': 0,
'right': 0,
'zIndex': 1002,
'padding': 0
},
'input': {
'width': '100%',
'fontSize': '1.4em',
'fontWeight': 'bold',
'color': '#88C9FF',
'backgroundColor': '#30475B',
'border': 'none',
'height': '50px',
'zIndex': 1003
},
'inputDiv': {
'paddingTop': 0,
'paddingRight': 0,
'paddingBottom': 0,
'paddingLeft': 8,
'height': '50px'
},
'searchList': {
'height': '300px',
'margin': '-370px 15px 0 15px',
'border': '1px solid #ccc',
'borderBottom': 'none',
'overflowY': 'auto',
'backgroundColor': '#535A5F',
'padding': '10px 20px',
'display': 'none'
},
'ul': {
'fontSize': '13px',
'listStyle': 'none',
'lineHeight': 1.2,
'margin': '0',
'padding': 0,
'position': 'relative',
'zIndex': 2
},
'li': {
'padding': '5px 5px',
'color': '#CACFD2'
},
'li:a': {
'color': '#EEAE18',
'display': 'block',
'padding': '5px 5px 5px 0'
},
'li:heading': {
'fontSize': '1.25em',
'textTransform': 'uppercase',
'padding': '5px 5px',
'color': '#E8ECEF'
},
'context': {
'color': '#F1F1F4',
'fontSize': '.9em',
'display': 'block',
'marginTop': 0,
'height': 'auto'
},
'wrapper': {
'height': '50px',
'position': 'absolute',
'top': 0,
'right': 0,
'zIndex': 1022,
'padding': 0,
'width': '100%',
'backgroundColor': '#18222A',
'color': '#D0DDEA'
},
'wrapperLeft': {
'float': 'right',
'width': '50%',
'textAlign': 'center',
'height': '50px',
'padding': 0,
'margin': '-13px',
'cursor': 'pointer'
},
'wrapperRight': {
'float': 'left',
'width': '50%',
'textAlign': 'center',
'height': '50px',
'padding': 0,
'margin': '-13px',
'cursor': 'pointer'
}
}
};
var App = (function (_React$Component) {
_inherits(App, _React$Component);
function App() {
_classCallCheck(this, App);
_get(Object.getPrototypeOf(App.prototype), 'constructor', this).call(this);
this.state = {};
}
_createClass(App, [{
key: 'render',
value: function render() {
return _react2['default'].createElement(_libTagSearchJs2['default'], { options: anchorOpts });
}
}]);
return App;
})(_react2['default'].Component);
(0, _reactDom.render)(_react2['default'].createElement(App, null), document.getElementById('anchor-search'));
},{"../../lib/tag-search.js":4,"react":163,"react-dom":8}],2:[function(require,module,exports){
/* */
'use strict';
'strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var classes = {
'searchBar': '',
'input': '',
'inputDiv': '',
'searchList': '',
'ul': '',
'li': '',
'li:a': '',
'li:heading': '',
'context': ''
};
exports['default'] = classes;
module.exports = exports['default'];
},{}],3:[function(require,module,exports){
/* */
'use strict';
'strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var styles = {
'searchBar': {
'height': '50px',
'width': '100%',
'position': 'fixed',
'bottom': 0,
'right': 0,
'zIndex': 1002,
'padding': 0
},
'input': {
'width': '100%',
'fontSize': '1.4em',
'fontWeight': 'bold',
'color': '#555',
'backgroundColor': '#f7f7f7',
'border': 'none',
'height': '50px',
'zIndex': 1003
},
'inputDiv': {
'paddingTop': 0,
'paddingRight': 0,
'paddingBottom': 0,
'paddingLeft': 8,
'height': '50px'
},
'searchList': {
'height': '300px',
'margin': '-370px 15px 0 15px',
'border': '1px solid #ccc',
'borderBottom': 'none',
'overflowY': 'auto',
'backgroundColor': '#fbfbfb',
'padding': '10px 20px',
'display': 'none'
},
'ul': {
'fontSize': '13px',
'listStyle': 'none',
'lineHeight': 1.2,
'margin': '0',
'padding': 0,
'position': 'relative',
'zIndex': 2
},
'li': {
'padding': '5px 5px',
'color': '#348dd9'
},
'li:a': {
'color': '#333',
'display': 'block',
'padding': '5px 5px 5px 0'
},
'li:heading': {
'fontSize': '1.25em',
'textTransform': 'uppercase',
'padding': '5px 5px',
'color': '#348dd9'
},
'context': {
'color': '#7a7a7a',
'fontSize': '.9em',
'display': 'block',
'marginTop': 0,
'height': 'auto'
},
'wrapper': {
'height': '50px',
'position': 'absolute',
'top': 0,
'right': 0,
'zIndex': 1022,
'padding': 0,
'width': '100%',
'backgroundColor': '#f7f7f7',
'color': '#7a7a7a'
},
'wrapperLeft': {
'float': 'left',
'width': '50%',
'textAlign': 'center',
'height': '50px',
'padding': 0,
'margin': '-13px',
'cursor': 'pointer'
},
'wrapperRight': {
'float': 'left',
'width': '50%',
'textAlign': 'center',
'height': '50px',
'padding': 0,
'margin': '-13px',
'cursor': 'pointer'
},
'active': {
'backgroundColor': '#c9dbea'
},
'caution': {
'backgroundColor': '#efce9e'
}
};
var defaultStyles = {
'searchBar': {},
'input': {},
'inputDiv': {},
'searchList': {},
'ul': {},
'li': {},
'li:a': {},
'li:heading': {},
'context': {},
'active': {
'backgroundColor': '#c9dbea'
},
'caution': {
'backgroundColor': '#efce9e'
},
'wrapper': {
'height': '50px',
'position': 'absolute',
'top': 0,
'right': 0,
'zIndex': 1022,
'padding': 0,
'width': '100%',
'backgroundColor': '#f7f7f7',
'color': '#7a7a7a'
},
'wrapperLeft': {
'float': 'left',
'width': '50%',
'textAlign': 'center',
'height': '50px',
'padding': 0,
'margin': '-13px',
'cursor': 'pointer'
},
'wrapperRight': {
'float': 'left',
'width': '50%',
'textAlign': 'center',
'height': '50px',
'padding': 0,
'margin': '-13px',
'cursor': 'pointer'
}
};
exports['default'] = styles;
exports.defaultStyles = defaultStyles;
},{}],4:[function(require,module,exports){
/* */
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _createClass = (function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
})();
var _get = function get(_x, _x2, _x3) {
var _again = true;_function: while (_again) {
var object = _x,
property = _x2,
receiver = _x3;desc = parent = getter = undefined;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) {
var parent = Object.getPrototypeOf(object);if (parent === null) {
return undefined;
} else {
_x = parent;_x2 = property;_x3 = receiver;_again = true;continue _function;
}
} else if ('value' in desc) {
return desc.value;
} else {
var getter = desc.get;if (getter === undefined) {
return undefined;
}return getter.call(receiver);
}
}
};
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _jquery = require('jquery');
var _jquery2 = _interopRequireDefault(_jquery);
var _lodash = require('lodash');
var _lodash2 = _interopRequireDefault(_lodash);
var _styles = require('./styles');
var _styles2 = _interopRequireDefault(_styles);
var _classes = require('./classes');
var _classes2 = _interopRequireDefault(_classes);
var Tagged = (function (_React$Component) {
_inherits(Tagged, _React$Component);
function Tagged(props) {
_classCallCheck(this, Tagged);
_get(Object.getPrototypeOf(Tagged.prototype), 'constructor', this).call(this);
this.displayName = 'anchorSearch';
this.state = {};
// private vars
this._limiters = false;
this._typingBit = false;
this._menuBit = false;
this._tagCache = [];
this._searchTermCache = '';
var opts = 'object' === _jquery2['default'].type(props.options) ? props.options : {};
// Anchored props
this.state.Anchored = {
searchBar: opts.searchBar || 'searchBar',
placeholder: opts.placeholder || "quick find",
searchList: opts.searchList || 'searchList',
tagSelector: opts.tagSelector || 'a[name]',
contextTextUntilTag: opts.contextTextUntilTag || "a[name]",
nameFromTag: opts.nameFromTag || ["H2", "H3", "H4"],
nameFromNextTag: opts.nameFromNextTag ? true : false,
nameFromTagAttr: opts.nameFromTagAttr || 'name',
nameFromTagSaveChildren: opts.nameFromTagSaveChildren || ':not("em, code")',
useLocation: opts.useLocation ? true : false,
noclasses: opts.noclasses ? true : false,
nostyles: opts.nostyles ? true : false,
forceSearch: opts.forceSearch || 2000,
wrapperLeftText: opts.wrapperLeftText || 'menu',
wrapperRightText: opts.wrapperRightText || 'search'
};
// classes
this.state.Anchored.classes = this.state.Anchored.noclasses ? _classes2['default'] : _lodash2['default'].defaults(opts.classes || {}, _classes2['default']);
// styles
this.state.Anchored.styles = this.state.Anchored.nostyles ? _styles.defaultStyles : _lodash2['default'].defaults(opts.styles || {}, _styles2['default']);
var anchored = _react2['default'].createElement('div', { id: this.state.Anchored.searchBar, style: this.state.Anchored.styles.searchBar, className: this.state.Anchored.classes.searchBar }, _react2['default'].createElement('div', { id: 'TSWrapper', style: this.state.Anchored.styles.wrapper }, _react2['default'].createElement('div', { id: 'TSWrapperLeft', style: this.state.Anchored.styles.wrapperLeft }, _react2['default'].createElement('h4', null, this.state.Anchored.wrapperLeftText)), _react2['default'].createElement('div', { id: 'TSWrapperRight', style: this.state.Anchored.styles.wrapperRight }, _react2['default'].createElement('h4', null, this.state.Anchored.wrapperRightText))), _react2['default'].createElement('div', { className: this.state.Anchored.classes.inputDiv, style: this.state.Anchored.styles.inputDiv }, _react2['default'].createElement('input', { style: this.state.Anchored.styles.input, type: 'text', placeholder: this.state.Anchored.placeholder, className: this.state.Anchored.classes.input }), _react2['default'].createElement('nav', { style: this.state.Anchored.styles.searchList, id: this.state.Anchored.searchList, className: this.state.Anchored.classes.searchList })));
this.state.__ANCHOREDr = location.pathname;
this.state.AnchorSearch = anchored;
_jquery2['default'].extend(true, this.state, props);
}
_createClass(Tagged, [{
key: 'render',
value: function render() {
// return React.cloneElement(Component, this.props)
return this.state.AnchorSearch;
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(props) {
var clean = location.pathname;
if (clean !== this.state.__ANCHOREDr) {
this.setState({
__ANCHOREDr: clean
});
this._update = true;
}
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
if (this._update) {
this.onUpdate();
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.onUpdate();
this.onMount();
}
}, {
key: 'onUpdate',
value: function onUpdate() {
var thisComponent = this;
this._update = false;
/**
* set some values on mount and update
* instead of on every listen event
* **/
thisComponent.setVars();
}
}, {
key: 'onMount',
value: function onMount() {
var thisComponent = this;
/**
* Search Bar
* takes the value from input and first searches for
* a match in anchor names then a full text search
* */
// catch menu clicks
(0, _jquery2['default'])(document).on('click', '.catchMenuClick a', function (e) {
thisComponent.catchMenuClick(e);
});
// hide the results when clicked outside
(0, _jquery2['default'])(document).on('mouseup', 'body', function (e) {
thisComponent.hideSearchList(e);
});
// jump to first anchor on page that matches and give a list of matches
(0, _jquery2['default'])(document).on('click input focus', '#' + thisComponent.state.Anchored.searchBar + ' input', function (e) {
thisComponent.wordWait(e.target.value);
});
// open menu on single click
(0, _jquery2['default'])(document).on('click', '#TSWrapperLeft', function (e) {
thisComponent.checkMenu();
});
// show search on double click
(0, _jquery2['default'])(document).on('click', '#TSWrapperRight', function (e) {
thisComponent.checkTyping();
});
}
}, {
key: 'setVars',
value: function setVars() {
var thisComponent = this;
thisComponent.$list = (0, _jquery2['default'])('#' + this.state.Anchored.searchBar + ' #' + this.state.Anchored.searchList);
thisComponent.$searchDiv = (0, _jquery2['default'])('#' + this.state.Anchored.searchBar);
thisComponent.$searchInput = thisComponent.$searchDiv.find('input');
thisComponent.$allAnchors = (0, _jquery2['default'])(thisComponent.state.Anchored.tagSelector);
thisComponent.$wrapper = (0, _jquery2['default'])('#TSWrapper');
return true;
}
}, {
key: 'checkTyping',
value: function checkTyping() {
if (this._typingBit) {
this.disAllowTyping();
} else {
this.allowTyping();
}
}
}, {
key: 'allowTyping',
value: function allowTyping() {
this._typingBit = true;
this.$wrapper.hide();
this.$searchInput.focus();
}
}, {
key: 'disAllowTyping',
value: function disAllowTyping() {
this._typingBit = false;
this.$wrapper.show();
}
}, {
key: 'checkMenu',
value: function checkMenu() {
if (this._menuBit) {
this.hideMenu();
} else {
this.showMenu();
}
}
}, {
key: 'showMenu',
value: function showMenu() {
this._menuBit = true;
this.searchTags(this.$searchInput.val());
}
}, {
key: 'hideMenu',
value: function hideMenu() {
this._menuBit = false;
this.$list.hide();
}
}, {
key: 'catchMenuClick',
value: function catchMenuClick(e) {
var thisComponent = this;
// catch a menu click and close any menus
thisComponent.hideMenu();
thisComponent.disAllowTyping();
// clean search bar status
thisComponent.$searchInput.css('background-color', _styles2['default'].input.backgroundColor);
}
}, {
key: 'hideSearchList',
value: function hideSearchList(e) {
var thisComponent = this;
var $list = thisComponent.$list;
var $searchDiv = thisComponent.$searchDiv;
if (!$list.is(e.target) // if the target of the click isn't the container...
&& $list.has(e.target).length === 0 && ( // ... nor a descendant of the container
!$searchDiv.is(e.target) // if the target of the click isn't the main div...
&& $searchDiv.has(e.target).length === 0) // if the target of the click isn't the input...
) {
thisComponent.hideMenu();
(0, _jquery2['default'])('#' + thisComponent.state.Anchored.searchBar + ' input').css('background-color', _styles2['default'].input.backgroundColor);
thisComponent.disAllowTyping();
return;
}
}
}, {
key: 'wordWait',
value: function wordWait(entry) {
var thisComponent = this;
if (!thisComponent._limiters) {
thisComponent._limiters = {
typed: entry
};
// open the list
//console.log('entry search')
return thisComponent.searchTags(entry);
}
var useMe = thisComponent._limiters;
var now = new Date().getTime();
// save the search term until done typing
useMe.typed = entry;
// kill the current interval
clearTimeout(thisComponent._limiters.interval);
// force search after specified time
if (useMe.force < now) {
//console.log('force search')
useMe.force = new Date().getTime() + this.state.Anchored.forceSearch;
thisComponent.searchTags(entry);
return false;
}
// update the forced search
useMe.force = new Date().getTime() + this.state.Anchored.forceSearch;
// set the interval to run the search
useMe.interval = setTimeout(function () {
//console.log('interval search')
thisComponent.searchTags(useMe.typed);
clearTimeout(thisComponent._limiters.interval);
}, 250);
}
}, {
key: 'searchTags',
value: function searchTags(search) {
var thisComponent = this;
var $list = thisComponent.$list;
var $searchInput = thisComponent.$searchInput;
var $allAnchors = thisComponent.$allAnchors;
var searchAnchors = {};
var isWide = document.body.clientWidth > 480;
// our search term fixed up
var searchedFor = search.replace('.', ' ').replace('-', ' ').toLowerCase();
var $firstAnchor = false;
var aBit = false; // bit for anchor presence
var bBit = false; // bit for blob search results presence
$list.html('');
// set display names
var mainHeader = undefined;
if (location.pathname.search('api') > -1) {
mainHeader = 'Method';
} else {
mainHeader = 'Anchor';
}
var ustyle = thisComponent.stringClassFromObject(thisComponent.state.Anchored.styles['li:heading']);
var uclass = thisComponent.state.Anchored.classes['li:heading'];
// create the method ul
var $ul = (0, _jquery2['default'])(document.createElement("ul")).css(thisComponent.state.Anchored.styles.ul).addClass('catchMenuClick ' + thisComponent.state.Anchored.classes.ul);
$ul.append('<li class="' + uclass + '" style="' + ustyle + '">' + mainHeader + ' Matches</li>');
// create the search blob ui
var $ul2 = (0, _jquery2['default'])(document.createElement("ul")).css(thisComponent.state.Anchored.styles.ul).addClass('catchMenuClick ' + thisComponent.state.Anchored.classes.ul);
$ul2.append('<li class="' + uclass + '" style="' + ustyle + '">Search Matches</li>');
// store all li in case of no matches
var allAnchors = (0, _jquery2['default'])(document.createElement("ul")).css(thisComponent.state.Anchored.styles.ul).addClass('catchMenuClick ' + thisComponent.state.Anchored.classes.ul);
allAnchors.append('<li class="' + uclass + '" style="' + ustyle + '">' + mainHeader + 's</li>');
// create search lists
$allAnchors.each(function (k, v) {
var $anchor = (0, _jquery2['default'])(v);
var text = $anchor.nextUntil(thisComponent.state.Anchored.contextTextUntilTag).andSelf().text();
// set display names
var name = $anchor[0][thisComponent.state.Anchored.nameFromTagAttr] || '';
var nameFromTag = $anchor[0][thisComponent.state.Anchored.nameFromTagAttr] || '';
// is the displayed name from the next tag
if (thisComponent.state.nameFromNextTag) {
var _$next = $anchor.next();
} else {
var _$next2 = $anchor;
}
if ('string' === typeof thisComponent.state.Anchored.nameFromTag && thisComponent.state.Anchored.nameFromTag.indexOf($next.prop("tagName")) > -1) {
nameFromTag = $next.clone().children(thisComponent.state.Anchored.nameFromTagSaveChildren).remove().end()[0][thisComponent.state.Anchored.nameFromTagAttr];
}
var listyle = thisComponent.stringClassFromObject(thisComponent.state.Anchored.styles['li']);
var liclass = thisComponent.state.Anchored.classes['li'];
var astyle = thisComponent.stringClassFromObject(thisComponent.state.Anchored.styles['li:a']);
var aclass = thisComponent.state.Anchored.classes['li:a'];
var cstyle = thisComponent.stringClassFromObject(thisComponent.state.Anchored.styles['context']);
var cclass = thisComponent.state.Anchored.classes['context'];
// large blurb
var itemDesc = '<li class="' + liclass + '" style="' + listyle + '"><a class="' + aclass + '" style="' + astyle + '"href="#' + name + '" >' + nameFromTag + '</a><div class="' + cclass + '" style="' + cstyle + '">' + _lodash2['default'].trunc(text, { 'length': 150, 'separator': ' ' }) + '</div></li>';
// smal blurg
var item = '<li class="' + liclass + '" style="' + listyle + '"><a class="' + aclass + '" style="' + astyle + '"href="#' + name + '" >' + nameFromTag + '</a><div class="' + cclass + '" style="' + cstyle + '">' + _lodash2['default'].trunc(text, { 'length': 150, 'separator': ' ' }) + '</div></li>';
// full text search
if (searchedFor !== '' && text !== '') {
var searchArray = searchedFor.split(' ');
if (!Array.isArray(searchArray)) {
searchArray = [];
}
var wordy = searchArray.some(function (word) {
if (text.toLowerCase().search(word) > -1) {
$ul2.append(itemDesc);
return true;
}
return false;
});
}
// populate method list
if (searchedFor !== '' && name.replace('-', ' ').replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase().search(searchedFor) > -1) {
$ul.append(item);
if (!$firstAnchor) {
$firstAnchor = $anchor;
}
}
allAnchors.append(item);
});
// set blob bit
bBit = $ul2[0].childElementCount > 1;
// set method bit
aBit = $ul[0].childElementCount > 1;
if (aBit && $firstAnchor[0].name) {
(function () {
var goTo = location.pathname + '#' + $firstAnchor[0].name;
// do we have history?
var pushHistory = undefined;
var replaceHistory = undefined;
var _history = false;
if ('object' === _jquery2['default'].type(thisComponent.props.history)) {
if ('function' === _jquery2['default'].type(thisComponent.props.history.pushState)) {
pushHistory = function () {
console.log('push history');
thisComponent.props.history.pushState(null, goTo);
};
replaceHistory = function () {
console.log('replace history');
thisComponent.props.history.replaceState(null, goTo);
};
_history = true;
}
}
// push the anchor
if (!isWide || thisComponent.state.Anchored.useLocation === false) {
// mobiles loses focus on history & location so just move with scrollTop
(0, _jquery2['default'])(document).scrollTop($firstAnchor.offset().top);
if (_history) {
replaceHistory();
}
} else {
// use window and send to history if requested
window.location.href = goTo;
if (_history) {
replaceHistory();
}
}
// we lose focus on mobile when a location change happens
$searchInput.blur().focus();
// set background to normal
$searchInput.css('background-color', _styles2['default'].active.backgroundColor);
})();
} else if (!bBit) {
aBit = true;
$ul = allAnchors;
$searchInput.css('background-color', _styles2['default'].caution.backgroundColor);
}
// reset the list so scroll goes to top
$list[0].innerHTML = '';
if (!isWide || (!bBit || !aBit)) {
if (aBit) {
$list.append($ul);
}
if (bBit) {
$list.append($ul2);
}
} else {
// float left methods
$list.append((0, _jquery2['default'])(document.createElement("div")).css({ float: 'left', width: '50%' }).append($ul));
// float left blob search
$list.append((0, _jquery2['default'])(document.createElement("div")).css({ float: 'left', width: '50%' }).append($ul2));
}
$list.show();
}
}, {
key: 'stringClassFromObject',
value: function stringClassFromObject(cobj) {
var str = '';
_jquery2['default'].each(cobj, function (k, v) {
if (k) str += _lodash2['default'].kebabCase(k) + ':' + v + '; ';
});
return str;
}
}, {
key: 'rateLimited',
value: function rateLimited(id, time) {
/**
* keeps a timer per id
* returns true if rate limited
* returns false if ok to run or new
* **/
var timer = new Date().getTime();
if ('number' === _jquery2['default'].type(this._limiters[id])) {
if (timer - this._limiters[id] < time) {
return true;
} else {
this._limiters[id] = timer;
return false;
}
} else {
this._limiters[id] = timer;
return false;
}
}
}]);
return Tagged;
})(_react2['default'].Component);
exports['default'] = Tagged;
module.exports = exports['default'];
},{"./classes":2,"./styles":3,"jquery":6,"lodash":7,"react":163}],5:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],6:[function(require,module,exports){
/*!
* jQuery JavaScript Library v2.1.4
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2015-04-28T16:01Z
*/
(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Support: Firefox 18+
// Can't be in strict mode, several libs including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335)
//
var arr = [];
var slice = arr.slice;
var concat = arr.concat;
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var support = {};
var
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
version = "2.1.4",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
},
// Support: Android<4.1
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num != null ?
// Return just the one element from the set
( num < 0 ? this[ num + this.length ] : this[ num ] ) :
// Return all the elements in a clean array
slice.call( this );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// Skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// Extend jQuery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
// Assume jQuery is ready without the ready module
isReady: true,
error: function( msg ) {
throw new Error( msg );
},
noop: function() {},
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray,
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
isNumeric: function( obj ) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
},
isPlainObject: function( obj ) {
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.constructor &&
!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
return false;
}
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true;
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android<4.0, iOS<6 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call(obj) ] || "object" :
typeof obj;
},
// Evaluates a script in a global context
globalEval: function( code ) {
var script,
indirect = eval;
code = jQuery.trim( code );
if ( code ) {
// If the code includes a valid, prologue position
// strict mode pragma, execute code by injecting a
// script tag into the document.
if ( code.indexOf("use strict") === 1 ) {
script = document.createElement("script");
script.text = code;
document.head.appendChild( script ).parentNode.removeChild( script );
} else {
// Otherwise, avoid the DOM node creation, insertion
// and removal by using an indirect global eval
indirect( code );
}
}
},
// Convert dashed to camelCase; used by the css and data modules
// Support: IE9-11+
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
}
}
return obj;
},
// Support: Android<4.1
trim: function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
}
first.length = i;
return first;
},
grep: function( elems, callback, invert ) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackInverse = !callback( elems[ i ], i );
if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] );
}
}
return matches;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value,
i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = [];
// Go through the array, translating each of the items to their new values
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
}
// Flatten any nested arrays
return concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
function isArraylike( obj ) {
// Support: iOS 8.2 (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = "length" in obj && obj.length,
type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v2.2.0-pre
* http://sizzlejs.com/
*
* Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2014-12-16
*/
(function( window ) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
}
return 0;
},
// General-purpose constants
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf as it's faster than native
// http://jsperf.com/thor-indexof-vs-for/5
indexOf = function( list, elem ) {
var i = 0,
len = list.length;
for ( ; i < len; i++ ) {
if ( list[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + characterEncoding + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
nodeType = context.nodeType;
if ( typeof selector !== "string" || !selector ||
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
return results;
}
if ( !seed && documentIsHTML ) {
// Try to shortcut find operations when possible (e.g., not under DocumentFragment)
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document (jQuery #6963)
if ( elem && elem.parentNode ) {
// Handle the case where IE, Oper