NodeList iterator missing in Chrome pre-v51
🐞 Bug report
💻 Version of CKEditor
12.3.1 (custom build). Potentially an issue going back further.
📋 Steps to reproduce
- Using chrome/chromium before version 51
- Placing a cursor or entering text results in an uncaught and blocking exception
✅ Expected result
An editor that works.
❎ Actual result
Uncaught (in promise) TypeError: n.querySelectorAll(...)[Symbol.iterator] is not a function(…)
📃 Other details that might be useful
Using querySelectorAll in a for loop is not supported in Chrome/Chromium versions prior to 51. NodeList does not provide a function for [Symbol.iterator].
There is a 'quick fix' available to ensure some base compatibility:
NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]
This fills in the missing iterator function and in basic testing resolves the blocking issue. But, I will acknowledge that a 2016 version of Chrome is probably on the trailing edge or outside the scope of browser support. Moreover, this 'polyfill' should only be applied when the NodeList prototype is missing the iterator function as to not override native implementations that may differ from the Array.prototype supplement.
I suspect this issue will be closed without any changes. However, I am submitting it so that it is indexed and discoverable to those that will need some form of fix they can get straight to a potential resolution.
- Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=538558
- Chromium version snapshot (for Mac): https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/369393/
For clarity, the exception is being raised on this line: https://github.com/ckeditor/ckeditor5-image/blob/8fa4acf7850e958526d0f049899f88cb91282a74/src/image/imageloadobserver.js#L68
@alexeckermann thanks for a detailed report. So the issue is that NodeList didn't implement iterator intefrface properly. querySelectorAll method is unrelated as it's called on a each separate item of collection.
As you expected we're not going to fix this issue as it's simply very outdated chrome version that doesn't stick to standards.
I'm happy that you found a workaround for that however I'll strongly suggest updating the browser, as it's a major security issue to run such an outdated browser.