B2G/gecko/browser/base/content/test/browser_urlHighlight.js
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .
function testVal(aExpected) {
  gURLBar.value = aExpected.replace(/[<>]/g, "");
  let selectionController = gURLBar.editor.selectionController;
  let selection = selectionController.getSelection(selectionController.SELECTION_URLSECONDARY);
  let value = gURLBar.editor.rootElement.textContent;
  let result = "";
  for (let i = 0; i < selection.rangeCount; i++) {
    let range = selection.getRangeAt(i).toString();
    let pos = value.indexOf(range);
    result += value.substring(0, pos) + "<" + range + ">";
    value = value.substring(pos + range.length);
  }
  result += value;
  is(result, aExpected);
}
function testVal ( aExpected ) { gURLBar . value = aExpected . replace ( / [<>] / g , "" ) ; let selectionController = gURLBar . editor . selectionController ; let selection = selectionController . getSelection ( selectionController . SELECTION_URLSECONDARY ) ; let value = gURLBar . editor . rootElement . textContent ; let result = "" ; for ( let i = 0 ; i < selection . rangeCount ; i ++ ) { let range = selection . getRangeAt ( i ) . toString ( ) ; let pos = value . indexOf ( range ) ; result += value . substring ( 0 , pos ) + "<" + range + ">" ; value = value . substring ( pos + range . length ) ; } result += value ; is ( result , aExpected ) ; }
Any copyright is dedicated to the Public Domain.
Any copyright is dedicated to the Public Domain .