-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NotSupportedError: DOM Exception 9: The implementation did not support the requested type of object or operation. #917
Comments
PRs + tests welcome! |
Example on Safari 9.0.2 (11601.3.9), for tag
|
Is there a more minimal example? On Mon, Jan 4, 2016, 15:53 Nian Wang notifications@github.com wrote:
|
Seems to be
Isn't supported in safari even though it has the native method. Would reverting back to a try/catch be acceptable @isiahmeadows ? |
Yes, but pull the try/catch out into its own function to keep Chrome from refusing to optimize the whole function. What would be best would be to pull it out into its own independent function: function appendTextFragment(parentElement, data) {
try {
parentElement.appendChild($document.createRange().createContextualFragment(data))
} catch (e) {
parentElement.insertAdjacentHTML("beforeend", data)
}
}
// And in injectHTML
if (nextSibling) {
// ...
} else {
appendTextFragment(parentElement, data)
} |
I was looking over Cito source earlier and noticed a lot of similar environment-dependent forking in frequently used functions. My ignorance of under-the-hood JIT optimisation logic leaves me somewhat unqualified, but wouldn't the best approach be to run a memoized function to test for this edge case on first execution and thereafter return the stored outcome? Back in the day when I wrote engine-dependent implementation forks of repeatedly-invoked functions, the function reference itself would be the test, that upon execution re-assigned the reference to point to the engine-specific variation. I get the impression this completely short-circuits certain engines procedures for optimising run time, but never found a way to validate the assertion. |
I'm not sure how to write a test for this @isiahmeadows |
@barneycarroll That won't work with |
Maybe once we get rid of the stupid mock, maybe it might work. |
Argh. Yeah, I see that problem ;) |
The only thing that even needs mocked is the XMLHttpRequest, so we aren't actually requesting anything, and can still read headers. |
Don't forget requestAnimationFrame for coercing async into sync behavior (unless you want to rewrite all the async tests on top of |
@pygy That, too. I didn't think of that. But the rest is probably best suited to die in the fires of |
Hi all, i just encountered first time this bug. After some try, i found solution to let him work in safari (and other browsers too): var range = $document.createRange();
range.selectNode(parentElement);
parentElement.appendChild(range.createContextualFragment(data)); I originally found bug in safari 5.1.10, so i guess this bug affect all recent safari versions |
@gabrieleceranto It's fixed: #923 |
@cmnstmntmn Not surprising, |
I think @lhorie will probably cut out another |
As of 270b20a, I'm getting this error in Safari (9.0.1). Chrome is unaffected.
The stack trace points to
createContextualFragment
on this line. Looking back at the previous commit, it looks like this part was refactored and a surrounding try/catch was removed?The text was updated successfully, but these errors were encountered: