Insert the section's markup in the DOM
970285
function (section, skipInsertHTML, refreshArgs) {
            // PROFILING // var profilingId = this.$startMeasure("Inserting section in DOM from " +
            // PROFILING // this.tplClasspath);
            var differed;
            var params = this._cfg;
            var tpl = this._tpl;
            var domElt = section.id ? section.getDom() : params.tplDiv;

            if (domElt) {
                if (!skipInsertHTML) {
                    section.insertHTML(domElt, refreshArgs);
                }
                if (!section.id) {
                    // the whole template is being refreshed; let's apply the correct size
                    // to its DOM container
                    ariaTemplatesLayout.setDivSize(domElt, tpl.$width, tpl.$height, 'hidden');
                }

                // update expando of container
                ariaUtilsDelegate.addExpando(domElt, section.delegateId);

                differed = section.initWidgets();
                this.__processDifferedItems(differed);
            } else {
                // TODO: LOG ERROR
            }
            if (!skipInsertHTML) {
                // Redundant, but makes sure that insertSection doesn't dispose the template
                this.$assert(743, params.tplDiv && tpl);
                ariaUtilsDom.refreshDomElt(params.tplDiv);
            }
            // PROFILING // this.$stopMeasure(profilingId);
        }
821917
function() {

      var x, els, y, div, blocks, el, next, previous, span;

      blocks = hashedit.config.blocks;

      // setup sortable classes
      els = document.querySelectorAll('[hashedit] ' + blocks);


      // set [data-hashedit-sortable=true]
      for (y = 0; y < els.length; y += 1) {

        // setup blocks
        if(els[y].querySelector('.hashedit-block-menu') === null) {

          els[y].setAttribute('hashedit-block', '');

          // create element menu
          div = document.createElement('DIV');
          div.setAttribute('class', 'hashedit-block-menu');
          div.setAttribute('contentEditable', 'false');
          div.innerHTML = '<label><i class="material-icons">more_vert</i> ' + hashedit.i18n('Layout Menu') + '</label>';

          // create up
          span = document.createElement('span');
          span.setAttribute('class', 'hashedit-block-add');
          span.innerHTML = '<i class="material-icons">add</i> ' + hashedit.i18n('Add');

          // append the handle to the wrapper
          div.appendChild(span);

          // create up
          span = document.createElement('span');
          span.setAttribute('class', 'hashedit-block-up');
          span.innerHTML = '<i class="material-icons">arrow_upward</i> ' + hashedit.i18n('Move Up');

          // append the handle to the wrapper
          div.appendChild(span);

          // create down
          span = document.createElement('span');
          span.setAttribute('class', 'hashedit-block-down');
          span.innerHTML = '<i class="material-icons">arrow_downward</i> ' + hashedit.i18n('Move Down');

          // append the handle to the wrapper
          div.appendChild(span);

          // create remove
          span = document.createElement('span');
          span.setAttribute('class', 'hashedit-block-duplicate');
          span.innerHTML = '<i class="material-icons">content_copy</i> ' + hashedit.i18n('Duplicate');

          // append the handle to the wrapper
          div.appendChild(span);

          // create properties
          span = document.createElement('span');
          span.setAttribute('class', 'hashedit-block-properties');
          span.innerHTML = '<i class="material-icons">settings</i> ' + hashedit.i18n('Settings');

          // append the handle to the wrapper
          div.appendChild(span);

          // create remove
          span = document.createElement('span');
          span.setAttribute('class', 'hashedit-block-remove');
          span.innerHTML = '<i class="material-icons">cancel</i> ' + hashedit.i18n('Remove');

          // append the handle to the wrapper
          div.appendChild(span);

          els[y].appendChild(div);

        }

      }

    }
198389
function makeInsertMarkup(markup, afterNode, toIndex) {
  // NOTE: Null values reduce hidden classes.
  return {
    type: 'INSERT_MARKUP',
    content: markup,
    fromIndex: null,
    fromNode: null,
    toIndex: toIndex,
    afterNode: afterNode
  };
}
1176605
function (obj) {
  var toc = [],
    tocTmpl = _.template("* [<%= heading %>](#<%= id %>)\n"),
    sectionTmpl = _.template("### <%= summary %>\n\n<%= body %>\n");

  // Finesse comment markdown data.
  // Also, statefully create TOC.
  var sections = _.chain(obj)
    .filter(function (c) {
      return !c.isPrivate && !c.ignore && _.any(c.tags, function (t) {
        return t.type === "api" && t.visibility === "public";
      });
    })
    .map(function (c) {
      // Add to TOC.
      toc.push(tocTmpl({
        heading: c.description.summary,
        id: _headingId(c.description.summary)
      }));

      return sectionTmpl(c.description);
    })
    .value()
    .join("");

  return "\n" + toc.join("") + "\n" + sections;
}
511133
function(html) {

      var x, newNode, node, firstChild;

      // create a new node
      newNode = document.createElement('div');
      newNode.innerHTML = html;

      // get new new node
      newNode = newNode.childNodes[0];
      newNode.setAttribute('hashedit-element', '');

      hashedit.setupElementMenu(newNode);

      // get existing node
      node = document.querySelector('[hashedit-sortable] [data-selector]');

      if (node === null) {

        if (hashedit.current.node !== null) {

          // insert after current node
          hashedit.current.node.parentNode.insertBefore(newNode, hashedit.current.node.nextSibling);

        }

      }
      else {
        // replace existing node with newNode
        node.parentNode.replaceChild(newNode, node);
      }

      var types = 'p, h1, h2, h3, h4, h5, li, td, th, blockquote, pre';

      // set editable children
      var editable = newNode.querySelectorAll(types);

      for (x = 0; x < editable.length; x += 1) {
        editable[x].setAttribute('contentEditable', 'true');
      }

      if (types.indexOf(newNode.nodeName.toLowerCase()) != -1) {
        newNode.setAttribute('contentEditable', 'true');
      }

      // select element
      function selectElementContents(el) {
        var range = document.createRange();
        range.selectNodeContents(el);
        var sel = window.getSelection();
        sel.removeAllRanges();
        sel.addRange(range);
      }

      // focus on first element
      if (editable.length > 0) {

        editable[0].focus();
        selectElementContents(editable[0]);

        // show edit options for the text
        hashedit.showTextOptions(editable[0]);

        // select editable contents, #ref: http://bit.ly/1jxd8er
        hashedit.selectElementContents(editable[0]);
      }
      else {

        if(newNode.matches(types)) {

          newNode.focus();
          selectElementContents(newNode);

        }

      }

      return newNode;

    }
246770
function updateHTMLTag(editor, node, width, height) {
	const srcAttr = getAttribute(node, 'src');
	const widthAttr = getAttribute(node, 'width');
	const heightAttr = getAttribute(node, 'height');

	editor.transact(() => {
		// apply changes from right to left, first for height, then for width
		let point;
		const quote = getAttributeQuote(editor, widthAttr || heightAttr || srcAttr);

		if (!heightAttr) {
			// no `height` attribute, add it right after `width` or `src`
			point = widthAttr ? widthAttr.end : srcAttr.end;
			editor.setTextInBufferRange([point, point], ` height=${quote}${height}${quote}`);
		} else {
			editor.setTextInBufferRange(getRange(heightAttr.value), String(height));
		}

		if (!widthAttr) {
			// no `width` attribute, add it right before `height` or after `src`
			point = heightAttr ? heightAttr.start : srcAttr.end;
			editor.setTextInBufferRange([point, point], `${!heightAttr ? ' ' : ''}width=${quote}${width}${quote}${heightAttr ? ' ' : ''}`);
		} else {
			editor.setTextInBufferRange(getRange(widthAttr.value), String(width));
		}
	});
}
233493
private void addNthLastChild() {
        for (Node node : nodes) {
            int count = 1;
            Node n = DOMHelper.getNextSiblingElement(node);
            while (n != null) {
                count++;
                n = DOMHelper.getNextSiblingElement(n);
            }
            
            if (specifier.isMatch(count)) {
                result.add(node);
            }
        }
    }
1186730
def add_section(self, section):
        
        self._sections = self._ensure_append(section, self._sections)
382875
function sectionLevel( &$sectionLevel, $headerLevel, &$TagStack, &$currentNode, &$domDocument )
    {
        if ( $sectionLevel < $headerLevel )
        {
            if ( $this->IsStrictHeader )
            {
                $sectionLevel += 1;
            }
            else
            {
                if ( ( $sectionLevel + 1 ) == $headerLevel )
                {
                    $sectionLevel += 1;
                }
                else
                {
                    for ( $i = 1; $i <= ( $headerLevel - $sectionLevel - 1 ); $i++ )
                    {
                        // Add section tag
                        unset( $subNode );
                        $subNode = new DOMElemenetNode( 'section' );
                        $currentNode->appendChild( $subNode );
                        $childTag = $this->SectionArray;
                        $TagStack[] = array( 'TagName' => 'section',
                                             'ParentNodeObject' => &$currentNode,
                                             'ChildTag' => $childTag );
                        $currentNode = $subNode;
                    }
                    $sectionLevel = $headerLevel;
                }
            }
        }
        elseif ( $sectionLevel == $headerLevel )
        {
            $lastNodeArray = array_pop( $TagStack );
            $lastNode = $lastNodeArray['ParentNodeObject'];
            $currentNode = $lastNode;
            $sectionLevel = $headerLevel;
        }
        else
        {
            for ( $i = 1; $i <= ( $sectionLevel - $headerLevel + 1 ); $i++ )
            {
                $lastNodeArray = array_pop( $TagStack );
                $lastTag = $lastNodeArray['TagName'];
                $lastNode = $lastNodeArray['ParentNodeObject'];
                $lastChildTag = $lastNodeArray['ChildTag'];
                $currentNode = $lastNode;
            }
            $sectionLevel = $headerLevel;
        }
        return $currentNode;
    }
17955
function attach() {
    const container = this.options.container;

    if (container instanceof HTMLElement) {
        const style = window.getComputedStyle(container);

        if (style.position === 'static') {
            container.style.position = 'relative';
        }
    }

    container.addEventListener('scroll', this._scroll);
    window.addEventListener('resize', this._scroll);
    this._scroll();
    this.attached = true;
}
1275226
def __createElementNS(self, root, uri, name, value):
        '''
        
        '''
        tag = root.ownerDocument.createElementNS(to_unicode(uri),
                                                 to_unicode(name))
        tag.appendChild(root.ownerDocument
                        .createCDATASection(to_unicode(value)))
        return root.appendChild(tag)
350568
function processSlides() {

		var sections = document.querySelectorAll( '[data-markdown]'),
			section;

		for( var i = 0, len = sections.length; i < len; i++ ) {

			section = sections[i];

			if( section.getAttribute( 'data-markdown' ).length ) {

				var xhr = new XMLHttpRequest(),
					url = section.getAttribute( 'data-markdown' );

				datacharset = section.getAttribute( 'data-charset' );

				// see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
				if( datacharset != null && datacharset != '' ) {
					xhr.overrideMimeType( 'text/html; charset=' + datacharset );
				}

				xhr.onreadystatechange = function() {
					if( xhr.readyState === 4 ) {
						if ( xhr.status >= 200 && xhr.status < 300 ) {

							section.outerHTML = slidify( xhr.responseText, {
								separator: section.getAttribute( 'data-separator' ),
								verticalSeparator: section.getAttribute( 'data-vertical' ),
								notesSeparator: section.getAttribute( 'data-notes' ),
								attributes: getForwardedAttributes( section )
							});

						}
						else {

							section.outerHTML = '<section data-state="alert">' +
								'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
								'Check your browser\'s JavaScript console for more details.' +
								'<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
								'</section>';

						}
					}
				};

				xhr.open( 'GET', url, false );

				try {
					xhr.send();
				}
				catch ( e ) {
					alert( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e );
				}

			}
			else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-vertical' ) || section.getAttribute( 'data-notes' ) ) {

				section.outerHTML = slidify( getMarkdownFromSlide( section ), {
					separator: section.getAttribute( 'data-separator' ),
					verticalSeparator: section.getAttribute( 'data-vertical' ),
					notesSeparator: section.getAttribute( 'data-notes' ),
					attributes: getForwardedAttributes( section )
				});

			}
			else {
				section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
			}
		}

	}
1343341
function (args) {
                var sectionMacro = this.macro;
                if (sectionMacro) {
                    // a macro is defined in the section, it is the default macro to use when refreshing
                    if (!args.macro) {
                        args.macro = sectionMacro;
                    } else {
                        var targetMacro = args.macro;
                        if (ariaUtilsType.isObject(targetMacro) && !targetMacro.name) {
                            targetMacro.name = sectionMacro.name;
                            targetMacro.scope = sectionMacro.scope;
                            if (!targetMacro.args) {
                                targetMacro.args = sectionMacro.args;
                            }
                        }
                    }
                }
                // Remove cached reference to the dom element, as it may change during the refresh
                // (occurs in tables in IE)
                this._domElt = null;
            }
843279
function(markup) {

	var container = document.createElement('div');
	container.innerHTML = markup;

	return new NWTNodeInstance(container.childNodes[0]);
}
887955
function() {

      var x, els;

      // setup [contentEditable=true]
      els = document.querySelectorAll(
        'p[hashedit-element], [hashedit] h1[hashedit-element], [hashedit] h2[hashedit-element], h3[hashedit-element], h4[hashedit-element], h5[hashedit-element], span[hashedit-element], ul[hashedit-element] li, ol[hashedit-element] li, table[hashedit-element] td, table[hashedit-element] th, blockquote[hashedit-element], pre[hashedit-element]'
      );

      for (x = 0; x < els.length; x += 1) {

        // add attribute
        els[x].setAttribute('contentEditable', 'true');

      }

    }
551022
function insertStaticSegments( components, segments, languages ) {

  for (var componentName in components) {
    if (components.hasOwnProperty( componentName )) {
      var language;
      var appliedTokens = [ ];
      var component = components[ componentName ];

      // Determine the language of the component.
      if (typeof languages === 'string')
        language = languages;
      else {
        var parts = componentName.split( '/', 2 );
        language = languages.indexOf( parts[ 0 ] ) >= 0 ? parts[ 0 ] : '';
      }

      // Insert static segments into a language specific component only.
      if (language) {
        // Get static segment tokens of the component.
        component.tokens.filter( function ( token ) {
          return token.isStatic;
        } )
          .forEach( function ( token ) {

            // Get segment.
            var segment = segments.get( language, token.name );

            // Insert the static segment into the component.
            var re = new RegExp( token.expression, 'g' );
            component.html = component.html.replace( re, segment.html );
            appliedTokens.push( token.name );
          } );

        // Remove applied segment tokens.
        component.tokens = component.tokens.filter( function ( token ) {
          return appliedTokens.indexOf( token.name ) < 0;
        } );
      }
    }
  }
}
304684
function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {

		if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
			previousParentElement = element;
			for( var i = 0; i < element.childNodes.length; i++ ) {
				childElement = element.childNodes[i];
				if ( i > 0 ) {
					j = i - 1;
					while ( j >= 0 ) {
						aPreviousChildElement = element.childNodes[j];
						if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
							previousParentElement = aPreviousChildElement;
							break;
						}
						j = j - 1;
					}
				}
				parentSection = section;
				if( childElement.nodeName ==  "section" ) {
					parentSection = childElement ;
					previousParentElement = childElement ;
				}
				if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
					addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
				}
			}
		}

		if ( element.nodeType == Node.COMMENT_NODE ) {
			if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
				addAttributeInElement( element, section, separatorSectionAttributes );
			}
		}
	}