_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q35800
train
function (elm, name, value) { elm = this.$$(elm).css(name, value); if (this.settings.update_styles) { updateInternalStyleAttr(this, elm); } }
javascript
{ "resource": "" }
q35801
train
function (e) { return this.run(e, function (e) { var i, attrs = e.attributes; for (i = attrs.length - 1; i >= 0; i--) { e.removeAttributeNode(attrs.item(i)); } }); }
javascript
{ "resource": "" }
q35802
train
function (elm, name, value) { var self = this, originalValue, hook, settings = self.settings; if (value === '') { value = null; } elm = self.$$(elm); originalValue = elm.attr(name); if (!elm.length) { return; } hook = self.attrHooks...
javascript
{ "resource": "" }
q35803
train
function (elm, attrs) { var self = this; self.$$(elm).each(function (i, node) { each(attrs, function (value, name) { self.setAttrib(node, name, value); }); }); }
javascript
{ "resource": "" }
q35804
train
function (elm, name, defaultVal) { var self = this, hook, value; elm = self.$$(elm); if (elm.length) { hook = self.attrHooks[name]; if (hook && hook.get) { value = hook.get(elm, name); } else { value = elm.attr(name); } }...
javascript
{ "resource": "" }
q35805
train
function (cssText) { var self = this, doc = self.doc, head, styleElm; // Prevent inline from loading the same styles twice if (self !== DOMUtils.DOM && doc === document) { var addedStyles = DOMUtils.DOM.addedStyles; addedStyles = addedStyles || []; if (addedStyles...
javascript
{ "resource": "" }
q35806
train
function (elm, html) { elm = this.$$(elm); if (isIE) { elm.each(function (i, target) { if (target.canHaveHTML === false) { return; } // Remove all child nodes, IE keeps empty text nodes in DOM while (target.firstChild) { ...
javascript
{ "resource": "" }
q35807
train
function (elm) { elm = this.get(elm); // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations return elm.nodeType == 1 && "outerHTML" in elm ? elm.outerHTML : $('<div></div>').append($(elm).clone()).html(); }
javascript
{ "resource": "" }
q35808
train
function (elm, html) { var self = this; self.$$(elm).each(function () { try { // Older FF doesn't have outerHTML 3.6 is still used by some organizations if ("outerHTML" in this) { this.outerHTML = html; return; } } catc...
javascript
{ "resource": "" }
q35809
train
function (node, referenceNode) { referenceNode = this.get(referenceNode); return this.run(node, function (node) { var parent, nextSibling; parent = referenceNode.parentNode; nextSibling = referenceNode.nextSibling; if (nextSibling) { parent.insertBe...
javascript
{ "resource": "" }
q35810
train
function (elm, name) { var self = this, newElm; if (elm.nodeName != name.toUpperCase()) { // Rename block element newElm = self.create(name); // Copy attribs to new block each(self.getAttribs(elm), function (attrNode) { self.setAttrib(newElm, attrNod...
javascript
{ "resource": "" }
q35811
train
function (a, b) { var ps = a, pe; while (ps) { pe = b; while (pe && ps != pe) { pe = pe.parentNode; } if (ps == pe) { break; } ps = ps.parentNode; } if (!ps && a.ownerDocument) { return a.o...
javascript
{ "resource": "" }
q35812
train
function (elm) { var attrs; elm = this.get(elm); if (!elm) { return []; } if (isIE) { attrs = []; // Object will throw exception in IE if (elm.nodeName == 'OBJECT') { return elm.attributes; } // IE doesn...
javascript
{ "resource": "" }
q35813
train
function (target, name, func, scope) { var self = this; if (Tools.isArray(target)) { var i = target.length; while (i--) { target[i] = self.bind(target[i], name, func, scope); } return target; } // Collect all window/document events ...
javascript
{ "resource": "" }
q35814
train
function (target, name, func) { var self = this, i; if (Tools.isArray(target)) { i = target.length; while (i--) { target[i] = self.unbind(target[i], name, func); } return target; } // Remove any bound events matching the input ...
javascript
{ "resource": "" }
q35815
train
function () { var self = this; // Unbind all events bound to window/document by editor instance if (self.boundEvents) { var i = self.boundEvents.length; while (i--) { var item = self.boundEvents[i]; this.events.unbind(item[0], item[1], item[2]); ...
javascript
{ "resource": "" }
q35816
loadScript
train
function loadScript(url, success, failure) { var dom = DOM, elm, id; // Execute callback when script is loaded function done() { dom.remove(id); if (elm) { elm.onreadystatechange = elm.onload = elm = null; } success(); } fun...
javascript
{ "resource": "" }
q35817
train
function (name, languages) { var language = AddOnManager.language; if (language && AddOnManager.languageLoad !== false) { if (languages) { languages = ',' + languages + ','; // Load short form sv.js or long form sv_SE.js if (languages.indexOf(',' + languag...
javascript
{ "resource": "" }
q35818
train
function (id, addOn, dependencies) { this.items.push(addOn); this.lookup[id] = { instance: addOn, dependencies: dependencies }; return addOn; }
javascript
{ "resource": "" }
q35819
train
function (name, addOnUrl, success, scope, failure) { var self = this, url = addOnUrl; function loadDependencies() { var dependencies = self.dependencies(name); each(dependencies, function (dep) { var newUrl = self.createUrl(addOnUrl, dep); self.load(newUrl....
javascript
{ "resource": "" }
q35820
findClosestIeRange
train
function findClosestIeRange(clientX, clientY, doc) { var element, rng, rects; element = doc.elementFromPoint(clientX, clientY); rng = doc.body.createTextRange(); if (!element || element.tagName == 'HTML') { element = doc.body; } rng.moveToElementText(element); rects ...
javascript
{ "resource": "" }
q35821
Node
train
function Node(name, type) { this.name = name; this.type = type; if (type === 1) { this.attributes = []; this.attributes.map = {}; } }
javascript
{ "resource": "" }
q35822
train
function (node, refNode, before) { var parent; if (node.parent) { node.remove(); } parent = refNode.parent || this; if (before) { if (refNode === parent.firstChild) { parent.firstChild = node; } else { refNode.prev.next = n...
javascript
{ "resource": "" }
q35823
addCustomElements
train
function addCustomElements(customElements) { var customElementRegExp = /^(~)?(.+)$/; if (customElements) { // Flush cached items since we are altering the default maps mapCache.text_block_elements = mapCache.block_elements = null; each(split(customElements, ','), function...
javascript
{ "resource": "" }
q35824
findEndTag
train
function findEndTag(schema, html, startIndex) { var count = 1, index, matches, tokenRegExp, shortEndedElements; shortEndedElements = schema.getShortEndedElements(); tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g; tokenRegExp.lastIn...
javascript
{ "resource": "" }
q35825
getBrClientRect
train
function getBrClientRect(brNode) { var doc = brNode.ownerDocument, rng = createRange(doc), nbsp = doc.createTextNode('\u00a0'), parentNode = brNode.parentNode, clientRect; parentNode.insertBefore(nbsp, brNode); rng.setStart(nbsp, 0); rng.setEnd(nb...
javascript
{ "resource": "" }
q35826
CaretPosition
train
function CaretPosition(container, offset, clientRects) { function isAtStart() { if (isText(container)) { return offset === 0; } return offset === 0; } function isAtEnd() { if (isText(container)) { return offset >= container.data.length; } ...
javascript
{ "resource": "" }
q35827
Selection
train
function Selection(dom, win, serializer, editor) { var self = this; self.dom = dom; self.win = win; self.serializer = serializer; self.editor = editor; self.bookmarkManager = new BookmarkManager(self); self.controlSelection = new ControlSelection(self, editor); // No W3...
javascript
{ "resource": "" }
q35828
train
function (node, offset) { var self = this, rng = self.dom.createRng(); if (!node) { self._moveEndPoint(rng, self.editor.getBody(), true); self.setRng(rng); } else { rng.setStart(node, offset); rng.setEnd(node, offset); self.setRng(rng); ...
javascript
{ "resource": "" }
q35829
train
function (node, content) { var self = this, dom = self.dom, rng = dom.createRng(), idx; // Clear stored range set by FocusManager self.lastFocusBookmark = null; if (node) { if (!content && self.controlSelection.controlSelect(node)) { return; } ...
javascript
{ "resource": "" }
q35830
train
function (toStart) { var self = this, rng = self.getRng(), node; // Control range on IE if (rng.item) { node = rng.item(0); rng = self.win.document.body.createTextRange(); rng.moveToElementText(node); } rng.collapse(!!toStart); self.setRng(...
javascript
{ "resource": "" }
q35831
train
function (w3c) { var self = this, selection, rng, elm, doc, ieRng, evt; function tryCompareBoundaryPoints(how, sourceRange, destinationRange) { try { return sourceRange.compareBoundaryPoints(how, destinationRange); } catch (ex) { // Gecko throws wrong documen...
javascript
{ "resource": "" }
q35832
train
function () { var self = this, rng = self.getRng(), elm; var startContainer, endContainer, startOffset, endOffset, root = self.dom.getRoot(); function skipEmptyTextNodes(node, forwards) { var orig = node; while (node && node.nodeType === 3 && node.length === 0) { ...
javascript
{ "resource": "" }
q35833
getAttribs
train
function getAttribs(node) { var attribs = {}; each(dom.getAttribs(node), function (attr) { var name = attr.nodeName.toLowerCase(); // Don't compare internal attributes or style if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) { ...
javascript
{ "resource": "" }
q35834
compareObjects
train
function compareObjects(obj1, obj2) { var value, name; for (name in obj1) { // Obj1 has item obj2 doesn't have if (obj1.hasOwnProperty(name)) { value = obj2[name]; // Obj2 doesn't have obj1 item if (typeof value == "undefined") { ...
javascript
{ "resource": "" }
q35835
process
train
function process(node) { var children, i, l, lastContentEditable, hasContentEditableState; // Node has a contentEditable value if (node.nodeType === 1 && getContentEditable(node)) { lastContentEditable = contentEditable; contentEditable = getContentEditable(node) =...
javascript
{ "resource": "" }
q35836
match
train
function match(name, vars, node) { var startNode; function matchParents(node) { var root = dom.getRoot(); if (node === root) { return false; } // Find first node with similar format settings node = dom.getParent(node, function (node) { ...
javascript
{ "resource": "" }
q35837
formatChanged
train
function formatChanged(formats, callback, similar) { var currentFormats; // Setup format node change logic if (!formatChangeData) { formatChangeData = {}; currentFormats = {}; ed.on('NodeChange', function (e) { var parents = getParents(e.element), matc...
javascript
{ "resource": "" }
q35838
replaceVars
train
function replaceVars(value, vars) { if (typeof value != "string") { value = value(vars); } else if (vars) { value = value.replace(/%(\w+)/g, function (str, name) { return vars[name] || str; }); } return value; }
javascript
{ "resource": "" }
q35839
removeFormat
train
function removeFormat(format, vars, node, compareNode) { var i, attrs, stylesModified; // Check if node matches format if (!matchName(node, format) && !isColorFormatAndAnchor(node, format)) { return FALSE; } // Should we compare with format attribs and styles ...
javascript
{ "resource": "" }
q35840
createCaretContainer
train
function createCaretContainer(fill) { var caretContainer = dom.create('span', { id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : '' }); if (fill) { caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR)); } return caretContai...
javascript
{ "resource": "" }
q35841
getParentCaretContainer
train
function getParentCaretContainer(node) { while (node) { if (node.id === caretContainerId) { return node; } node = node.parentNode; } }
javascript
{ "resource": "" }
q35842
findFirstTextNode
train
function findFirstTextNode(node) { var walker; if (node) { walker = new TreeWalker(node, node); for (node = walker.current(); node; node = walker.next()) { if (node.nodeType === 3) { return node; } } } ...
javascript
{ "resource": "" }
q35843
applyCaretFormat
train
function applyCaretFormat() { var rng, caretContainer, textNode, offset, bookmark, container, text; rng = selection.getRng(true); offset = rng.startOffset; container = rng.startContainer; text = container.nodeValue; caretContainer = getParentCaretContainer(s...
javascript
{ "resource": "" }
q35844
moveStart
train
function moveStart(rng) { var container = rng.startContainer, offset = rng.startOffset, isAtEndOfText, walker, node, nodes, tmpNode; if (rng.startContainer == rng.endContainer) { if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) { return; ...
javascript
{ "resource": "" }
q35845
train
function () { var level; if (index < data.length - 1) { level = data[++index]; Levels.applyToEditor(editor, level, false); setDirty(true); editor.fire('redo', { level: level }); } return level; }
javascript
{ "resource": "" }
q35846
train
function () { data = []; index = 0; self.typing = false; self.data = data; editor.fire('ClearUndos'); }
javascript
{ "resource": "" }
q35847
train
function (callback1, callback2) { var lastLevel, bookmark; if (self.transact(callback1)) { bookmark = data[index].bookmark; lastLevel = data[index - 1]; Levels.applyToEditor(editor, lastLevel, true); if (self.transact(callback2)) { data...
javascript
{ "resource": "" }
q35848
execCommand
train
function execCommand(command, ui, value, args) { var func, customCommand, state = 0; if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) { editor.focus(); } args = editor.fire('BeforeExecCommand', { command: co...
javascript
{ "resource": "" }
q35849
queryCommandState
train
function queryCommandState(command) { var func; // Is hidden then return undefined if (editor.quirks.isHidden()) { return; } command = command.toLowerCase(); if ((func = commands.state[command])) { return func(command); } // Browser ...
javascript
{ "resource": "" }
q35850
train
function () { if (selection.isCollapsed()) { var elm = editor.dom.getParent(editor.selection.getStart(), 'a'); if (elm) { editor.dom.remove(elm, true); } return; } formatter.remove("link"); }
javascript
{ "resource": "" }
q35851
train
function (command) { var align = command.substring(7); if (align == 'full') { align = 'justify'; } // Remove all other alignments first each('left,center,right,justify'.split(','), function (name) { if (align != name) { formatter....
javascript
{ "resource": "" }
q35852
hasRightSideContent
train
function hasRightSideContent() { var walker = new TreeWalker(container, parentBlock), node; var nonEmptyElementsMap = editor.schema.getNonEmptyElements(); while ((node = walker.next())) { if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) { ...
javascript
{ "resource": "" }
q35853
URI
train
function URI(url, settings) { var self = this, baseUri, baseUrl; url = trim(url); settings = self.settings = settings || {}; baseUri = settings.base_uri; // Strange app protocol that isn't http/https or local anchor // For example: mailto,skype,tel etc. if (/^([\w\-]+):([^\/]...
javascript
{ "resource": "" }
q35854
train
function (path) { var self = this; path = /^(.*?)\/?(\w+)?$/.exec(path); // Update path parts self.path = path[0]; self.directory = path[1]; self.file = path[2]; // Rebuild source self.source = ''; self.getURI(); }
javascript
{ "resource": "" }
q35855
train
function (uri) { var self = this, output; if (uri === "./") { return uri; } uri = new URI(uri, { base_uri: self }); // Not on same domain/port or protocol if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port || ...
javascript
{ "resource": "" }
q35856
train
function (uri, noHost) { uri = new URI(uri, { base_uri: this }); return uri.getURI(noHost && this.isSameOrigin(uri)); }
javascript
{ "resource": "" }
q35857
train
function (noProtoHost) { var s, self = this; // Rebuild source if (!self.source || noProtoHost) { s = ''; if (!noProtoHost) { if (self.protocol) { s += self.protocol + '://'; } else { s += '//'; } ...
javascript
{ "resource": "" }
q35858
fire
train
function fire(name, args) { var handlers, i, l, callback; name = name.toLowerCase(); args = args || {}; args.type = name; // Setup target is there isn't one if (!args.target) { args.target = scope; } // Add event delegation methods if they are...
javascript
{ "resource": "" }
q35859
on
train
function on(name, callback, prepend, extra) { var handlers, names, i; if (callback === false) { callback = returnFalse; } if (callback) { callback = { func: callback }; if (extra) { Tools.extend(callback, extra); ...
javascript
{ "resource": "" }
q35860
off
train
function off(name, callback) { var i, handlers, bindingName, names, hi; if (name) { names = name.toLowerCase().split(' '); i = names.length; while (i--) { name = names[i]; handlers = bindings[name]; // Unbind all handlers if...
javascript
{ "resource": "" }
q35861
once
train
function once(name, callback, prepend) { return on(name, callback, prepend, { once: true }); }
javascript
{ "resource": "" }
q35862
train
function (data) { var name, value; data = data || {}; for (name in data) { value = data[name]; if (value instanceof Binding) { data[name] = value.create(this, name); } } this.data = data; }
javascript
{ "resource": "" }
q35863
train
function (name, value) { var key, args, oldValue = this.data[name]; if (value instanceof Binding) { value = value.create(this, name); } if (typeof name === "object") { for (key in name) { this.set(key, name[key]); } return this; ...
javascript
{ "resource": "" }
q35864
unique
train
function unique(array) { var uniqueItems = [], i = array.length, item; while (i--) { item = array[i]; if (!item.__checked) { uniqueItems.push(item); item.__checked = 1; } } i = uniqueItems.length; while (i--) { delete uniqueItems[i].__...
javascript
{ "resource": "" }
q35865
parseChunks
train
function parseChunks(selector, selectors) { var parts = [], extra, matches, i; do { chunker.exec(""); matches = chunker.exec(selector); if (matches) { selector = matches[3]; parts.push(matches[1]); if (matches[2]) { ...
javascript
{ "resource": "" }
q35866
train
function (container) { var matches = [], i, l, selectors = this._selectors; function collect(items, selector, index) { var i, l, fi, fl, item, filters = selector[index]; for (i = 0, l = items.length; i < l; i++) { item = items[i]; // Run each filter against...
javascript
{ "resource": "" }
q35867
train
function (items) { var self = this; // Force single item into array if (!Tools.isArray(items)) { if (items instanceof Collection) { self.add(items.toArray()); } else { push.call(self, items); } } else { push.apply(self, ite...
javascript
{ "resource": "" }
q35868
train
function (items) { var self = this, len = self.length, i; self.length = 0; self.add(items); // Remove old entries for (i = self.length; i < len; i++) { delete self[i]; } return self; }
javascript
{ "resource": "" }
q35869
train
function (selector) { var self = this, i, l, matches = [], item, match; // Compile string into selector expression if (typeof selector === "string") { selector = new Selector(selector); match = function (item) { return selector.match(item); }; ...
javascript
{ "resource": "" }
q35870
train
function (ctrl) { var self = this, i = self.length; while (i--) { if (self[i] === ctrl) { break; } } return i; }
javascript
{ "resource": "" }
q35871
train
function (name) { var self = this, args = Tools.toArray(arguments).slice(1); self.each(function (item) { if (item[name]) { item[name].apply(item, args); } }); return self; }
javascript
{ "resource": "" }
q35872
train
function (value) { var len, radix = 10; if (!value) { return; } if (typeof value === "number") { value = value || 0; return { top: value, left: value, bottom: value, right: value }; } ...
javascript
{ "resource": "" }
q35873
train
function (cls) { if (cls && !this.contains(cls)) { this.cls._map[cls] = true; this.cls.push(cls); this._change(); } return this; }
javascript
{ "resource": "" }
q35874
train
function (cls) { if (this.contains(cls)) { for (var i = 0; i < this.cls.length; i++) { if (this.cls[i] === cls) { break; } } this.cls.splice(i, 1); delete this.cls._map[cls]; this._change(); } return this; ...
javascript
{ "resource": "" }
q35875
train
function (cls, state) { var curState = this.contains(cls); if (curState !== state) { if (curState) { this.remove(cls); } else { this.add(cls); } this._change(); } return this; }
javascript
{ "resource": "" }
q35876
train
function (elm) { var ctrl, lookup = this.getRoot().controlIdLookup; while (elm && lookup) { ctrl = lookup[elm.id]; if (ctrl) { break; } elm = elm.parentNode; } return ctrl; }
javascript
{ "resource": "" }
q35877
train
function () { var self = this; self.parent()._lastRect = null; DomUtils.css(self.getEl(), { width: '', height: '' }); self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null; self.initLayoutRect(); }
javascript
{ "resource": "" }
q35878
train
function (name, callback) { var self = this; function resolveCallbackName(name) { var callback, scope; if (typeof name != 'string') { return name; } return function (e) { if (!callback) { self.parentsAndSelf().each(function...
javascript
{ "resource": "" }
q35879
train
function (selector) { var self = this, ctrl, parents = new Collection(); // Add each parent to collection for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) { parents.add(ctrl); } // Filter away everything that doesn't match the selector if (selector) { ...
javascript
{ "resource": "" }
q35880
train
function (suffix) { var id = suffix ? this._id + '-' + suffix : this._id; if (!this._elmCache[id]) { this._elmCache[id] = $('#' + id)[0]; } return this._elmCache[id]; }
javascript
{ "resource": "" }
q35881
train
function (name, value) { var self = this, elm = self.getEl(self.ariaTarget); if (typeof value === "undefined") { return self._aria[name]; } self._aria[name] = value; if (self.state.get('rendered')) { elm.setAttribute(name == 'role' ? name : 'aria-' + name, ...
javascript
{ "resource": "" }
q35882
train
function (text, translate) { if (translate !== false) { text = this.translate(text); } return (text || '').replace(/[&<>"]/g, function (match) { return '&#' + match.charCodeAt(0) + ';'; }); }
javascript
{ "resource": "" }
q35883
train
function (items) { var self = this, parent = self.parent(); if (parent) { parent.insert(items, parent.items().indexOf(self), true); } return self; }
javascript
{ "resource": "" }
q35884
train
function (align) { function getOffset(elm, rootElm) { var x, y, parent = elm; x = y = 0; while (parent && parent != rootElm && parent.nodeType) { x += parent.offsetLeft || 0; y += parent.offsetTop || 0; parent = parent.offsetParent; } ...
javascript
{ "resource": "" }
q35885
train
function () { ReflowQueue.remove(this); var parent = this.parent(); if (parent._layout && !parent._layout.isNative()) { parent.reflow(); } return this; }
javascript
{ "resource": "" }
q35886
train
function (type, settings) { var ControlType; // If string is specified then use it as the type if (typeof type == 'string') { settings = settings || {}; settings.type = type; } else { settings = type; type = settings.type; } // Fi...
javascript
{ "resource": "" }
q35887
getRole
train
function getRole(elm) { elm = elm || focusedElement; if (isElement(elm)) { return elm.getAttribute('role'); } return null; }
javascript
{ "resource": "" }
q35888
getParentRole
train
function getParentRole(elm) { var role, parent = elm || focusedElement; while ((parent = parent.parentNode)) { if ((role = getRole(parent))) { return role; } } }
javascript
{ "resource": "" }
q35889
getFocusElements
train
function getFocusElements(elm) { var elements = []; function collect(elm) { if (elm.nodeType != 1 || elm.style.display == 'none' || elm.disabled) { return; } if (canFocus(elm)) { elements.push(elm); } for (var i = 0; i < elm.ch...
javascript
{ "resource": "" }
q35890
getNavigationRoot
train
function getNavigationRoot(targetControl) { var navigationRoot, controls; targetControl = targetControl || focusedControl; controls = targetControl.parents().toArray(); controls.unshift(targetControl); for (var i = 0; i < controls.length; i++) { navigationRoot = contr...
javascript
{ "resource": "" }
q35891
focusFirst
train
function focusFirst(targetControl) { var navigationRoot = getNavigationRoot(targetControl); var focusElements = getFocusElements(navigationRoot.getEl()); if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) { moveFocusToIndex(navigationRoot.lastAriaIndex, foc...
javascript
{ "resource": "" }
q35892
moveFocusToIndex
train
function moveFocusToIndex(idx, elements) { if (idx < 0) { idx = elements.length - 1; } else if (idx >= elements.length) { idx = 0; } if (elements[idx]) { elements[idx].focus(); } return idx; }
javascript
{ "resource": "" }
q35893
moveFocus
train
function moveFocus(dir, elements) { var idx = -1, navigationRoot = getNavigationRoot(); elements = elements || getFocusElements(navigationRoot.getEl()); for (var i = 0; i < elements.length; i++) { if (elements[i] === focusedElement) { idx = i; } } ...
javascript
{ "resource": "" }
q35894
left
train
function left() { var parentRole = getParentRole(); if (parentRole == "tablist") { moveFocus(-1, getFocusElements(focusedElement.parentNode)); } else if (focusedControl.parent().submenu) { cancel(); } else { moveFocus(-1); } }
javascript
{ "resource": "" }
q35895
right
train
function right() { var role = getRole(), parentRole = getParentRole(); if (parentRole == "tablist") { moveFocus(1, getFocusElements(focusedElement.parentNode)); } else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) { enter(); } else { ...
javascript
{ "resource": "" }
q35896
down
train
function down() { var role = getRole(), parentRole = getParentRole(); if (role == "menuitem" && parentRole == "menubar") { enter(); } else if (role == "button" && getAriaProp('haspopup')) { enter({ key: 'down' }); } else { moveFocus(1); } }
javascript
{ "resource": "" }
q35897
tab
train
function tab(e) { var parentRole = getParentRole(); if (parentRole == "tablist") { var elm = getFocusElements(focusedControl.getEl('body'))[0]; if (elm) { elm.focus(); } } else { moveFocus(e.shiftKey ? -1 : 1); } }
javascript
{ "resource": "" }
q35898
train
function (selector) { selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector); return selector.find(this); }
javascript
{ "resource": "" }
q35899
train
function (items) { var self = this; self.items().add(self.create(items)).parent(self); return self; }
javascript
{ "resource": "" }