Create HTML text node. This is used by the VML renderer as well as the SVG
renderer through the useHTML option.

@param {String} str
@param {Number} x
@param {Number} y
512841
function (str, x, y) {
            var wrapper = this.createElement('span'),
              element = wrapper.element,
              renderer = wrapper.renderer;

            // Text setter
            wrapper.textSetter = function (value) {
                if (value !== element.innerHTML) {
                    delete this.bBox;
                }
                element.innerHTML = this.textStr = value;
            };

            // Various setters which rely on update transform
            wrapper.xSetter = wrapper.ySetter = wrapper.alignSetter = wrapper.rotationSetter = function (value, key) {
                if (key === 'align') {
                    key = 'textAlign'; // Do not overwrite the SVGElement.align method. Same as VML.
                }
                wrapper[key] = value;
                wrapper.htmlUpdateTransform();
            };

            // Set the default attributes
            wrapper.attr({
                  text: str,
                  x: mathRound(x),
                  y: mathRound(y)
              })
              .css({
                  position: ABSOLUTE,
                  whiteSpace: 'nowrap',
                  fontFamily: this.style.fontFamily,
                  fontSize: this.style.fontSize
              });

            // Use the HTML specific .css method
            wrapper.css = wrapper.htmlCss;

            // This is specific for HTML within SVG
            if (renderer.isSVG) {
                wrapper.add = function (svgGroupWrapper) {

                    var htmlGroup,
                      container = renderer.box.parentNode,
                      parentGroup,
                      parents = [];

                    this.parentGroup = svgGroupWrapper;

                    // Create a mock group to hold the HTML elements
                    if (svgGroupWrapper) {
                        htmlGroup = svgGroupWrapper.div;
                        if (!htmlGroup) {

                            // Read the parent chain into an array and read from top down
                            parentGroup = svgGroupWrapper;
                            while (parentGroup) {

                                parents.push(parentGroup);

                                // Move up to the next parent group
                                parentGroup = parentGroup.parentGroup;
                            }

                            // Ensure dynamically updating position when any parent is translated
                            each(parents.reverse(), function (parentGroup) {
                                var htmlGroupStyle;

                                // Create a HTML div and append it to the parent div to emulate
                                // the SVG group structure
                                htmlGroup = parentGroup.div = parentGroup.div || createElement(DIV, {
                                      className: attr(parentGroup.element, 'class')
                                  }, {
                                      position: ABSOLUTE,
                                      left: (parentGroup.translateX || 0) + PX,
                                      top: (parentGroup.translateY || 0) + PX
                                  }, htmlGroup || container); // the top group is appended to container

                                // Shortcut
                                htmlGroupStyle = htmlGroup.style;

                                // Set listeners to update the HTML div's position whenever the SVG group
                                // position is changed
                                extend(parentGroup, {
                                    translateXSetter: function (value, key) {
                                        htmlGroupStyle.left = value + PX;
                                        parentGroup[key] = value;
                                        parentGroup.doTransform = true;
                                    },
                                    translateYSetter: function (value, key) {
                                        htmlGroupStyle.top = value + PX;
                                        parentGroup[key] = value;
                                        parentGroup.doTransform = true;
                                    },
                                    visibilitySetter: function (value, key) {
                                        htmlGroupStyle[key] = value;
                                    }
                                });
                            });

                        }
                    } else {
                        htmlGroup = container;
                    }

                    htmlGroup.appendChild(element);

                    // Shared with VML:
                    wrapper.added = true;
                    if (wrapper.alignOnAdd) {
                        wrapper.htmlUpdateTransform();
                    }

                    return wrapper;
                };
            }
            return wrapper;
        }
551001
public Element svgText(double x, double y, String text) {
    return SVGUtil.svgText(document, x, y, text);
  }
98942
function(str) {
            var ring, linestring, linearring;
            var rings = OpenLayers.String.trim(str).split(this.regExes.parenComma);
            var components = [];
            for(var i=0, len=rings.length; i<len; ++i) {
                ring = rings[i].replace(this.regExes.trimParens, '$1');
                linestring = this.parse.linestring.apply(this, [ring]).geometry;
                linearring = new OpenLayers.Geometry.LinearRing(linestring.components);
                components.push(linearring);
            }
            return new OpenLayers.Feature.Vector(
                new OpenLayers.Geometry.Polygon(components)
            );
        }
154877
function renderNode(node, children = []) {
    [...children].forEach(child => {
        if (child && child.tag) {
            node.ele(child.tag, child.props);
            renderNode(node, child.children);
            node.end();
        } else {
            node.text(child);
        }
    });
}
1109416
function text(node) {
  var data = node.data || {}

  if (
    own.call(data, 'hName') ||
    own.call(data, 'hProperties') ||
    own.call(data, 'hChildren')
  ) {
    return false
  }

  return 'value' in node
}
620120
@Override
    public void renderCharset( PositionedText target, double x, double y, String text, String set )
    {
        target.add( x, y, text );
    }
445887
def html(string)
      ptr = Libcgraph.agstrdup_html(graph.ptr, string)
      string = ptr.read_string
      Libcgraph.agstrfree graph.ptr, ptr

      string
    end
843139
function (str) {
            var xmlDoc;
            var DOMParser = Aria.$global.DOMParser;
            if (DOMParser) {
                var parser = new DOMParser();
                xmlDoc = parser.parseFromString(str, "text/xml");
            } else { // Internet Explorer
                var ActiveXObject = Aria.$global.ActiveXObject;
                xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.async = "false";
                xmlDoc.loadXML(str);
            }

            if (xmlDoc.hasChildNodes()) {
                return this.__parseXmlNode(xmlDoc);
            } else {
                return null;
            }
        }
208910
public void parseHtmlData(PrintWriter out, String str)
    {
        int iCurrentParsePos = 0;
        int iCurrentOutputPos = 0;
        int iStartTag, iStartVelocity;
        while (true)
        { // Done
        	iStartTag = str.indexOf('<', iCurrentParsePos);
        	iStartVelocity = str.indexOf("${", iCurrentParsePos);
        	if ((iStartTag == -1) && (iStartVelocity == -1))
    			break;	// Done
        	String strTag, strParams, strData;
        	int iNextParam, iEndCloseTag;
    		if ((iStartVelocity == -1) || (iStartVelocity > iStartTag))
    		{	// xml format param
	            iCurrentParsePos = iStartTag + 1;
	            if (iCurrentParsePos == str.length())
	                break;
	            if (str.charAt(iStartTag + 1) == '/') // Don't process end tags
	                continue;
	            int iEndTag = str.indexOf(' ', iStartTag);
	            int iEndParam = str.indexOf('>', iStartTag);
	            if (iEndParam == -1)
	                break;      // poorly formed XML
	            int iNextVelocity = str.indexOf("${", iCurrentParsePos);
	            if (iNextVelocity != -1) if (iNextVelocity < iEndParam)
	                continue;   // This handles the case: <IMG=${image}>   (used internally)
	            iNextParam = str.indexOf('<', iCurrentParsePos);
	            if (iNextParam != -1) if (iNextParam < iEndParam)
	                continue;   // This handles the case: <IMG=<image/>>   (used internally)
	            if (iNextVelocity != -1) if (iNextVelocity < iNextParam)
	            	iNextParam = iNextVelocity;
	            iEndCloseTag = iEndParam;
	            if (str.charAt(iEndParam - 1) == '/')
	                iEndParam = iEndParam - 1;
	            if ((iEndTag == -1) || (iEndTag > iEndParam))
	                iEndTag = iEndParam;
	            strTag = str.substring(iStartTag + 1, iEndTag);
	            strParams = null;
	            if (iEndTag != iEndParam)
	                strParams = str.substring(iEndTag + 1, iEndParam);
	            strData = null;
	            int iStartCloseTag = -1;
	            
	            if (iCurrentOutputPos != iStartTag)
	                out.print(str.substring(iCurrentOutputPos, iStartTag));     // Print everything up to the start of the tag.
	            iCurrentOutputPos = iStartTag;
	            
	            if (str.charAt(iEndCloseTag) != '/')
	            {   // Find the end tag (if start tag doesn't end in '/')
	                iStartCloseTag = str.indexOf("</" + strTag + '>', iEndTag);
	                if (iStartCloseTag > iEndTag)
	                {
	                    iEndCloseTag = iStartCloseTag + strTag.length() + 2;
	                    strData = str.substring(iEndParam + 1, iStartCloseTag);
	                }
	            }
        	}
    		else
    		{	// Velocity format param
    			strParams = null;
    			strData = null;
    			
	            iCurrentParsePos = iStartTag + 2;	// ${
	            if (iCurrentParsePos == str.length())
	                break;
	            iEndCloseTag = str.indexOf('}', iStartTag);
	            if (iEndCloseTag == -1)
	                break;      // poorly formed Velocity tag
    			strTag = str.substring(iStartTag + 2, iEndCloseTag);

	            int iNextVelocity = str.indexOf("${", iCurrentParsePos);
	            iNextParam = str.indexOf('<', iCurrentParsePos);
	            if (iNextVelocity != -1) if (iNextVelocity < iNextParam)
	            	iNextParam = iNextVelocity;
    		}

            // Now, I have the tag, params, and data for this tag
            boolean bProcessed = this.parseHtmlTag(out, strTag, strParams, strData);
            
            if (!bProcessed)
            {
                out.print(str.substring(iCurrentOutputPos, iNextParam));     // It wasn't processed, so output it.
                iCurrentOutputPos = iNextParam;
            }
            else
                iCurrentOutputPos = iEndCloseTag + 1;
            iCurrentParsePos = iCurrentOutputPos;
        }
        iStartTag = str.length();
        if (iCurrentOutputPos != iStartTag)
            out.println(str.substring(iCurrentOutputPos, iStartTag));
    }
218524
function htmlTreeAsString (elem) {
  var MAX_TRAVERSE_HEIGHT = 5
  var MAX_OUTPUT_LEN = 80
  var out = []
  var height = 0
  var len = 0
  var separator = ' > '
  var sepLength = separator.length
  var nextStr

  while (elem && height++ < MAX_TRAVERSE_HEIGHT) {
    nextStr = htmlElementAsString(elem)
    // bail out if
    // - nextStr is the 'html' element
    // - the length of the string that would be created exceeds MAX_OUTPUT_LEN
    //   (ignore this limit if we are on the first iteration)
    if (
      nextStr === 'html' ||
      (height > 1 &&
       len + (out.length * sepLength) + nextStr.length >= MAX_OUTPUT_LEN)
    ) {
      break
    }

    out.push(nextStr)

    len += nextStr.length
    elem = elem.parentNode
  }

  return out.reverse().join(separator)
}
1018371
function copyTextUsingDOM (str) {
  const tempElem = document.createElement('div')
  // Setting an individual property does not support `!important`, so we set the
  // whole style instead of just the `-webkit-user-select` property.
  tempElem.setAttribute('style', '-webkit-user-select: text !important')

  // Use shadow DOM if available.
  let spanParent = tempElem
  if (tempElem.attachShadow) {
    spanParent = tempElem.attachShadow({ mode: 'open' })
  }

  const span = document.createElement('span')
  span.innerText = str

  spanParent.appendChild(span)
  document.body.appendChild(tempElem)
  selectionSet(span)

  const result = document.execCommand('copy')

  selectionClear()
  document.body.removeChild(tempElem)

  return result
}
1160890
private DetailHtmlBuilder htmlTreeNode(CallTreeNode node, DetailHtmlBuilder htmlBuilder, StringifierFactory htmlStringifierFactory) throws IOException {
		htmlBuilder.begin("li")
			.text(node.getName()).text(":&nbsp;");
		if (node.getParent()!=null) {
			htmlBuilder
				.text(htmlStringifierFactory.toString(node.getPercent())).text("%")
				.text(", ");
		}
		htmlBuilder
			.text("total&nbsp;").text(htmlStringifierFactory.toString(node.getTotal(), "Time"))
			.text(", ")
			.text("count&nbsp;").text(htmlStringifierFactory.toString(node.getSplitCount()));
		if (!node.getChildren().isEmpty()) {
			htmlBuilder.begin("ul");
			for(CallTreeNode childNode:node.getChildren()) {
				htmlTreeNode(childNode, htmlBuilder, htmlStringifierFactory);
			}
			htmlBuilder.end("ul");
		}
		return htmlBuilder.end("li");
	}
323116
function(node, text)
	{
		if (node.innerText !== undefined)
		{
			node.innerText = text;
		}
		else
		{
			node[(node.textContent === undefined) ? 'text' : 'textContent'] = text;
		}
	}
999185
function htmlStringify(obj, fromRecur) {

	var tag = (fromRecur) ? 'span' : 'div';
	var nextLevel = (fromRecur || 0) + 1;
	
	// strings
	if (typeof obj == 'string') {
		return '<' + tag + ' style="color: #0e4889; cursor: default;">"' + obj + '"</' + tag + '>';
	}
	// booleans, null and undefined
	else if (typeof obj == 'boolean' || obj === null || obj === undefined) {
		return '<' + tag + '><em style="color: #06624b; cursor: default;">' + obj + '</em></' + tag + '>';
	}
	// numbers
	else if (typeof obj == 'number') {
		return '<' + tag + ' style="color: #ca000a; cursor: default;">' + obj + '</' + tag + '>';
	}
	// dates
	else if (Object.prototype.toString.call(obj) == '[object Date]') {
		return '<' + tag + ' style="color: #009f7b; cursor: default;">' + obj + '</' + tag + '>';
	}
	// arrays
	else if (Array.isArray(obj)) {
		
		var rtn = '<' + tag + ' style="color: #666; cursor: default;">Array: [';
		
		if (!obj.length) {
			return rtn + ']</' + tag + '>';
		}
		
		rtn += '</' + tag + '><div style="padding-left: 20px;">';
		
		for (var i = 0; i < obj.length; i++) {
			rtn += '<span></span>' + htmlStringify(obj[i], nextLevel); // give the DOM structure has as many elements as an object, for collapse behaviour
			if (i < obj.length - 1) {
				rtn += ', <br>';
			}
		}
	
		return rtn + '</div><' + tag + ' style="color: #666">]</' + tag + '>';
		
	}
	// objects
	else if (obj && typeof obj == 'object') {
		
		var rtn = '',
			len = Object.keys(obj).length;
	
		if (fromRecur && !len) {
			return '<' + tag + ' style="color: #999; cursor: default;">Object: {}</' + tag + '>';
		}
		
		if (fromRecur) {
			rtn += '<' + tag + ' style="color: #0b89b6">Object: {</' + tag + '><div class="_stringify_recur _stringify_recur_level_' + fromRecur + '" style="padding-left: 20px;">';
		}
		
		for (var key in obj) {
			if (typeof obj[key] != 'function') {
				rtn += '<div><span style="padding-right: 5px; cursor: default;">' +key + ':</span>' + htmlStringify(obj[key], nextLevel) + '</div>';
			}
		}
		
		if (fromRecur) {
			rtn += '</div><' + tag + ' style="color: #0b89b6; cursor: default;">}</' + tag + '>';
		}
		
		return rtn;
		
	}

	return '';

}
1324195
function (wrapper) {
            var textNode = wrapper.element,
              renderer = this,
              forExport = renderer.forExport,
              textStr = pick(wrapper.textStr, '').toString(),
              hasMarkup = textStr.indexOf('<') !== -1,
              lines,
              childNodes = textNode.childNodes,
              styleRegex,
              hrefRegex,
              parentX = attr(textNode, 'x'),
              textStyles = wrapper.styles,
              width = wrapper.textWidth,
              textLineHeight = textStyles && textStyles.lineHeight,
              textStroke = textStyles && textStyles.HcTextStroke,
              i = childNodes.length,
              getLineHeight = function (tspan) {
                  return textLineHeight ?
                    pInt(textLineHeight) :
                    renderer.fontMetrics(
                      /(px|em)$/.test(tspan && tspan.style.fontSize) ?
                        tspan.style.fontSize :
                        ((textStyles && textStyles.fontSize) || renderer.style.fontSize || 12),
                      tspan
                    ).h;
              };

            /// remove old text
            while (i--) {
                textNode.removeChild(childNodes[i]);
            }

            // Skip tspans, add text directly to text node. The forceTSpan is a hook
            // used in text outline hack.
            if (!hasMarkup && !textStroke && textStr.indexOf(' ') === -1) {
                textNode.appendChild(doc.createTextNode(textStr));
                return;

                // Complex strings, add more logic
            } else {

                styleRegex = /<.*style="([^"]+)".*>/;
                hrefRegex = /<.*href="(http[^"]+)".*>/;

                if (width && !wrapper.added) {
                    this.box.appendChild(textNode); // attach it to the DOM to read offset width
                }

                if (hasMarkup) {
                    lines = textStr
                      .replace(/<(b|strong)>/g, '<span style="font-weight:bold">')
                      .replace(/<(i|em)>/g, '<span style="font-style:italic">')
                      .replace(/<a/g, '<span')
                      .replace(/<\/(b|strong|i|em|a)>/g, '</span>')
                      .split(/<br.*?>/g);

                } else {
                    lines = [textStr];
                }


                // remove empty line at end
                if (lines[lines.length - 1] === '') {
                    lines.pop();
                }


                // build the lines
                each(lines, function (line, lineNo) {
                    var spans, spanNo = 0;

                    line = line.replace(/<span/g, '|||<span').replace(/<\/span>/g, '</span>|||');
                    spans = line.split('|||');

                    each(spans, function (span) {
                        if (span !== '' || spans.length === 1) {
                            var attributes = {},
                              tspan = doc.createElementNS(SVG_NS, 'tspan'),
                              spanStyle; // #390
                            if (styleRegex.test(span)) {
                                spanStyle = span.match(styleRegex)[1].replace(/(;| |^)color([ :])/, '$1fill$2');
                                attr(tspan, 'style', spanStyle);
                            }
                            if (hrefRegex.test(span) && !forExport) { // Not for export - #1529
                                attr(tspan, 'onclick', 'location.href=\"' + span.match(hrefRegex)[1] + '\"');
                                css(tspan, { cursor: 'pointer' });
                            }

                            span = (span.replace(/<(.|\n)*?>/g, '') || ' ')
                              .replace(/&lt;/g, '<')
                              .replace(/&gt;/g, '>');

                            // Nested tags aren't supported, and cause crash in Safari (#1596)
                            if (span !== ' ') {

                                // add the text node
                                tspan.appendChild(doc.createTextNode(span));

                                if (!spanNo) { // first span in a line, align it to the left
                                    if (lineNo && parentX !== null) {
                                        attributes.x = parentX;
                                    }
                                } else {
                                    attributes.dx = 0; // #16
                                }

                                // add attributes
                                attr(tspan, attributes);

                                // Append it
                                textNode.appendChild(tspan);

                                // first span on subsequent line, add the line height
                                if (!spanNo && lineNo) {

                                    // allow getting the right offset height in exporting in IE
                                    if (!hasSVG && forExport) {
                                        css(tspan, { display: 'block' });
                                    }

                                    // Set the line height based on the font size of either
                                    // the text element or the tspan element
                                    attr(
                                      tspan,
                                      'dy',
                                      getLineHeight(tspan)
                                    );
                                }

                                // check width and apply soft breaks
                                if (width) {
                                    var words = span.replace(/([^\^])-/g, '$1- ').split(' '), // #1273
                                      hasWhiteSpace = spans.length > 1 || (words.length > 1 && textStyles.whiteSpace !== 'nowrap'),
                                      tooLong,
                                      actualWidth,
                                      hcHeight = textStyles.HcHeight,
                                      rest = [],
                                      dy = getLineHeight(tspan),
                                      softLineNo = 1,
                                      bBox;

                                    while (hasWhiteSpace && (words.length || rest.length)) {
                                        delete wrapper.bBox; // delete cache
                                        bBox = wrapper.getBBox();
                                        actualWidth = bBox.width;

                                        // Old IE cannot measure the actualWidth for SVG elements (#2314)
                                        if (!hasSVG && renderer.forExport) {
                                            actualWidth = renderer.measureSpanWidth(tspan.firstChild.data, wrapper.styles);
                                        }

                                        tooLong = actualWidth > width;
                                        if (!tooLong || words.length === 1) { // new line needed
                                            words = rest;
                                            rest = [];
                                            if (words.length) {
                                                softLineNo++;
                                                if (hcHeight && softLineNo * dy > hcHeight) {
                                                    words = ['...'];
                                                    wrapper.attr('title', wrapper.textStr);
                                                } else {

                                                    tspan = doc.createElementNS(SVG_NS, 'tspan');
                                                    attr(tspan, {
                                                        dy: dy,
                                                        x: parentX
                                                    });
                                                    if (spanStyle) { // #390
                                                        attr(tspan, 'style', spanStyle);
                                                    }
                                                    textNode.appendChild(tspan);
                                                }
                                            }
                                            if (actualWidth > width) { // a single word is pressing it out
                                                width = actualWidth;
                                            }
                                        } else { // append to existing line tspan
                                            tspan.removeChild(tspan.firstChild);
                                            rest.unshift(words.pop());
                                        }
                                        if (words.length) {
                                            tspan.appendChild(doc.createTextNode(words.join(' ').replace(/- /g, '-')));
                                        }
                                    }
                                }

                                spanNo++;
                            }
                        }
                    });
                });
            }
        }
754655
function(markup) {

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

	return new NWTNodeInstance(container.childNodes[0]);
}
422994
function stringifyNode(node)
{
	var result = "<"+node.nodeName;
	var numAttrs = node.attrs.length;
	
	for (var i=0; i<numAttrs; i++)
	{
		result += " "+ node.attrs[i].name +'="'+ node.attrs[i].value +'"';
	}
	
	result += ">";
	
	return result;
}