[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 187423] insertAdjacentHTML raises RangeException (possibly
From:       Richard Smith <kde () metafoo ! co ! uk>
Date:       2009-03-17 16:41:03
Message-ID: 20090317164103.24AFD13241 () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=187423





--- Comment #1 from Richard Smith <kde metafoo co uk>  2009-03-17 17:41:02 ---
For reference, here's the code which ext-js uses to emulate insertAdjacentHTML:

    var N = R.ownerDocument.createRange();
    var S;
    switch (P) {
      case "beforebegin":
        N.setStartBefore(R);
        S = N.createContextualFragment(Q);
        R.parentNode.insertBefore(S, R);
        return R.previousSibling;
      case "afterbegin":
        if (R.firstChild)
          {
            N.setStartBefore(R.firstChild);
            S = N.createContextualFragment(Q);
            R.insertBefore(S, R.firstChild);
            return R.firstChild;
          }
        else
          {
            R.innerHTML = Q;
            return R.firstChild;
          }
      case "beforeend":
        if (R.lastChild)
          {
            N.setStartAfter(R.lastChild);
            S = N.createContextualFragment(Q);
            R.appendChild(S);
            return R.lastChild;
          }
        else
          {
            R.innerHTML = Q;
            return R.lastChild;
          }
      case "afterend":
        N.setStartAfter(R);
        S = N.createContextualFragment(Q);
        R.parentNode.insertBefore(S, R.nextSibling);
        return R.nextSibling;
    }
    throw "Illegal insertion point -> \"" + P + "\"";

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic