|
|
@@ -1061,6 +1061,17 @@ domClass("HTMLAudioElement", tag("AUDIO"));
|
|
|
* media elements only (so `"play" in div` stays false). play() resolves
|
|
|
* without playing: pages call it without a catch on scroll, and a
|
|
|
* rejection would only add an "Uncaught" line per element. */
|
|
|
+/* <canvas> has no drawing backend: getContext() answers null for every
|
|
|
+ * context type, like a browser with 2D/WebGL disabled, so libraries take
|
|
|
+ * their "no canvas/WebGL" path (MapLibre reports "Failed to initialize
|
|
|
+ * WebGL") instead of calling an undefined method. */
|
|
|
+def("__nb_canvas", {
|
|
|
+ getContext: function () { return null; },
|
|
|
+ toDataURL: function () { return "data:,"; },
|
|
|
+ toBlob: function (cb) { if (typeof cb === "function") setTimeout(function () { cb(null); }, 0); },
|
|
|
+ transferControlToOffscreen: function () { throw new DOMException("not supported", "NotSupportedError"); }
|
|
|
+});
|
|
|
+
|
|
|
def("__nb_media", {
|
|
|
play: function () { return Promise.resolve(); },
|
|
|
pause: function () {},
|