HTMLImageElement.js
  1  "use strict";
  2  
  3  const conversions = require("webidl-conversions");
  4  const utils = require("./utils.js");
  5  
  6  const HTMLConstructor_helpers_html_constructor = require("../helpers/html-constructor.js").HTMLConstructor;
  7  const ceReactionsPreSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPreSteps;
  8  const ceReactionsPostSteps_helpers_custom_elements = require("../helpers/custom-elements.js").ceReactionsPostSteps;
  9  const parseURLToResultingURLRecord_helpers_document_base_url =
 10    require("../helpers/document-base-url.js").parseURLToResultingURLRecord;
 11  const serializeURLwhatwg_url = require("whatwg-url").serializeURL;
 12  const parseNonNegativeInteger_helpers_strings = require("../helpers/strings.js").parseNonNegativeInteger;
 13  const implSymbol = utils.implSymbol;
 14  const ctorRegistrySymbol = utils.ctorRegistrySymbol;
 15  const HTMLElement = require("./HTMLElement.js");
 16  
 17  const interfaceName = "HTMLImageElement";
 18  
 19  exports.is = value => {
 20    return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation;
 21  };
 22  exports.isImpl = value => {
 23    return utils.isObject(value) && value instanceof Impl.implementation;
 24  };
 25  exports.convert = (value, { context = "The provided value" } = {}) => {
 26    if (exports.is(value)) {
 27      return utils.implForWrapper(value);
 28    }
 29    throw new TypeError(`${context} is not of type 'HTMLImageElement'.`);
 30  };
 31  
 32  function makeWrapper(globalObject) {
 33    if (globalObject[ctorRegistrySymbol] === undefined) {
 34      throw new Error("Internal error: invalid global object");
 35    }
 36  
 37    const ctor = globalObject[ctorRegistrySymbol]["HTMLImageElement"];
 38    if (ctor === undefined) {
 39      throw new Error("Internal error: constructor HTMLImageElement is not installed on the passed global object");
 40    }
 41  
 42    return Object.create(ctor.prototype);
 43  }
 44  
 45  exports.create = (globalObject, constructorArgs, privateData) => {
 46    const wrapper = makeWrapper(globalObject);
 47    return exports.setup(wrapper, globalObject, constructorArgs, privateData);
 48  };
 49  
 50  exports.createImpl = (globalObject, constructorArgs, privateData) => {
 51    const wrapper = exports.create(globalObject, constructorArgs, privateData);
 52    return utils.implForWrapper(wrapper);
 53  };
 54  
 55  exports._internalSetup = (wrapper, globalObject) => {
 56    HTMLElement._internalSetup(wrapper, globalObject);
 57  };
 58  
 59  exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => {
 60    privateData.wrapper = wrapper;
 61  
 62    exports._internalSetup(wrapper, globalObject);
 63    Object.defineProperty(wrapper, implSymbol, {
 64      value: new Impl.implementation(globalObject, constructorArgs, privateData),
 65      configurable: true
 66    });
 67  
 68    wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
 69    if (Impl.init) {
 70      Impl.init(wrapper[implSymbol]);
 71    }
 72    return wrapper;
 73  };
 74  
 75  exports.new = globalObject => {
 76    const wrapper = makeWrapper(globalObject);
 77  
 78    exports._internalSetup(wrapper, globalObject);
 79    Object.defineProperty(wrapper, implSymbol, {
 80      value: Object.create(Impl.implementation.prototype),
 81      configurable: true
 82    });
 83  
 84    wrapper[implSymbol][utils.wrapperSymbol] = wrapper;
 85    if (Impl.init) {
 86      Impl.init(wrapper[implSymbol]);
 87    }
 88    return wrapper[implSymbol];
 89  };
 90  
 91  const exposed = new Set(["Window"]);
 92  
 93  exports.install = (globalObject, globalNames) => {
 94    if (!globalNames.some(globalName => exposed.has(globalName))) {
 95      return;
 96    }
 97  
 98    if (globalObject.HTMLElement === undefined) {
 99      throw new Error("Internal error: attempting to evaluate HTMLImageElement before HTMLElement");
100    }
101    class HTMLImageElement extends globalObject.HTMLElement {
102      constructor() {
103        return HTMLConstructor_helpers_html_constructor(globalObject, interfaceName, new.target);
104      }
105  
106      get alt() {
107        const esValue = this !== null && this !== undefined ? this : globalObject;
108  
109        if (!exports.is(esValue)) {
110          throw new TypeError("'get alt' called on an object that is not a valid instance of HTMLImageElement.");
111        }
112  
113        ceReactionsPreSteps_helpers_custom_elements(globalObject);
114        try {
115          const value = esValue[implSymbol].getAttributeNS(null, "alt");
116          return value === null ? "" : value;
117        } finally {
118          ceReactionsPostSteps_helpers_custom_elements(globalObject);
119        }
120      }
121  
122      set alt(V) {
123        const esValue = this !== null && this !== undefined ? this : globalObject;
124  
125        if (!exports.is(esValue)) {
126          throw new TypeError("'set alt' called on an object that is not a valid instance of HTMLImageElement.");
127        }
128  
129        V = conversions["DOMString"](V, {
130          context: "Failed to set the 'alt' property on 'HTMLImageElement': The provided value"
131        });
132  
133        ceReactionsPreSteps_helpers_custom_elements(globalObject);
134        try {
135          esValue[implSymbol].setAttributeNS(null, "alt", V);
136        } finally {
137          ceReactionsPostSteps_helpers_custom_elements(globalObject);
138        }
139      }
140  
141      get src() {
142        const esValue = this !== null && this !== undefined ? this : globalObject;
143  
144        if (!exports.is(esValue)) {
145          throw new TypeError("'get src' called on an object that is not a valid instance of HTMLImageElement.");
146        }
147  
148        ceReactionsPreSteps_helpers_custom_elements(globalObject);
149        try {
150          const value = esValue[implSymbol].getAttributeNS(null, "src");
151          if (value === null) {
152            return "";
153          }
154          const urlRecord = parseURLToResultingURLRecord_helpers_document_base_url(
155            value,
156            esValue[implSymbol]._ownerDocument
157          );
158          if (urlRecord !== null) {
159            return serializeURLwhatwg_url(urlRecord);
160          }
161          return conversions.USVString(value);
162        } finally {
163          ceReactionsPostSteps_helpers_custom_elements(globalObject);
164        }
165      }
166  
167      set src(V) {
168        const esValue = this !== null && this !== undefined ? this : globalObject;
169  
170        if (!exports.is(esValue)) {
171          throw new TypeError("'set src' called on an object that is not a valid instance of HTMLImageElement.");
172        }
173  
174        V = conversions["USVString"](V, {
175          context: "Failed to set the 'src' property on 'HTMLImageElement': The provided value"
176        });
177  
178        ceReactionsPreSteps_helpers_custom_elements(globalObject);
179        try {
180          esValue[implSymbol].setAttributeNS(null, "src", V);
181        } finally {
182          ceReactionsPostSteps_helpers_custom_elements(globalObject);
183        }
184      }
185  
186      get srcset() {
187        const esValue = this !== null && this !== undefined ? this : globalObject;
188  
189        if (!exports.is(esValue)) {
190          throw new TypeError("'get srcset' called on an object that is not a valid instance of HTMLImageElement.");
191        }
192  
193        ceReactionsPreSteps_helpers_custom_elements(globalObject);
194        try {
195          const value = esValue[implSymbol].getAttributeNS(null, "srcset");
196          return value === null ? "" : conversions.USVString(value);
197        } finally {
198          ceReactionsPostSteps_helpers_custom_elements(globalObject);
199        }
200      }
201  
202      set srcset(V) {
203        const esValue = this !== null && this !== undefined ? this : globalObject;
204  
205        if (!exports.is(esValue)) {
206          throw new TypeError("'set srcset' called on an object that is not a valid instance of HTMLImageElement.");
207        }
208  
209        V = conversions["USVString"](V, {
210          context: "Failed to set the 'srcset' property on 'HTMLImageElement': The provided value"
211        });
212  
213        ceReactionsPreSteps_helpers_custom_elements(globalObject);
214        try {
215          esValue[implSymbol].setAttributeNS(null, "srcset", V);
216        } finally {
217          ceReactionsPostSteps_helpers_custom_elements(globalObject);
218        }
219      }
220  
221      get sizes() {
222        const esValue = this !== null && this !== undefined ? this : globalObject;
223  
224        if (!exports.is(esValue)) {
225          throw new TypeError("'get sizes' called on an object that is not a valid instance of HTMLImageElement.");
226        }
227  
228        ceReactionsPreSteps_helpers_custom_elements(globalObject);
229        try {
230          const value = esValue[implSymbol].getAttributeNS(null, "sizes");
231          return value === null ? "" : value;
232        } finally {
233          ceReactionsPostSteps_helpers_custom_elements(globalObject);
234        }
235      }
236  
237      set sizes(V) {
238        const esValue = this !== null && this !== undefined ? this : globalObject;
239  
240        if (!exports.is(esValue)) {
241          throw new TypeError("'set sizes' called on an object that is not a valid instance of HTMLImageElement.");
242        }
243  
244        V = conversions["DOMString"](V, {
245          context: "Failed to set the 'sizes' property on 'HTMLImageElement': The provided value"
246        });
247  
248        ceReactionsPreSteps_helpers_custom_elements(globalObject);
249        try {
250          esValue[implSymbol].setAttributeNS(null, "sizes", V);
251        } finally {
252          ceReactionsPostSteps_helpers_custom_elements(globalObject);
253        }
254      }
255  
256      get crossOrigin() {
257        const esValue = this !== null && this !== undefined ? this : globalObject;
258  
259        if (!exports.is(esValue)) {
260          throw new TypeError("'get crossOrigin' called on an object that is not a valid instance of HTMLImageElement.");
261        }
262  
263        ceReactionsPreSteps_helpers_custom_elements(globalObject);
264        try {
265          const value = esValue[implSymbol].getAttributeNS(null, "crossorigin");
266          return value === null ? "" : value;
267        } finally {
268          ceReactionsPostSteps_helpers_custom_elements(globalObject);
269        }
270      }
271  
272      set crossOrigin(V) {
273        const esValue = this !== null && this !== undefined ? this : globalObject;
274  
275        if (!exports.is(esValue)) {
276          throw new TypeError("'set crossOrigin' called on an object that is not a valid instance of HTMLImageElement.");
277        }
278  
279        if (V === null || V === undefined) {
280          V = null;
281        } else {
282          V = conversions["DOMString"](V, {
283            context: "Failed to set the 'crossOrigin' property on 'HTMLImageElement': The provided value"
284          });
285        }
286  
287        ceReactionsPreSteps_helpers_custom_elements(globalObject);
288        try {
289          esValue[implSymbol].setAttributeNS(null, "crossorigin", V);
290        } finally {
291          ceReactionsPostSteps_helpers_custom_elements(globalObject);
292        }
293      }
294  
295      get useMap() {
296        const esValue = this !== null && this !== undefined ? this : globalObject;
297  
298        if (!exports.is(esValue)) {
299          throw new TypeError("'get useMap' called on an object that is not a valid instance of HTMLImageElement.");
300        }
301  
302        ceReactionsPreSteps_helpers_custom_elements(globalObject);
303        try {
304          const value = esValue[implSymbol].getAttributeNS(null, "usemap");
305          return value === null ? "" : value;
306        } finally {
307          ceReactionsPostSteps_helpers_custom_elements(globalObject);
308        }
309      }
310  
311      set useMap(V) {
312        const esValue = this !== null && this !== undefined ? this : globalObject;
313  
314        if (!exports.is(esValue)) {
315          throw new TypeError("'set useMap' called on an object that is not a valid instance of HTMLImageElement.");
316        }
317  
318        V = conversions["DOMString"](V, {
319          context: "Failed to set the 'useMap' property on 'HTMLImageElement': The provided value"
320        });
321  
322        ceReactionsPreSteps_helpers_custom_elements(globalObject);
323        try {
324          esValue[implSymbol].setAttributeNS(null, "usemap", V);
325        } finally {
326          ceReactionsPostSteps_helpers_custom_elements(globalObject);
327        }
328      }
329  
330      get isMap() {
331        const esValue = this !== null && this !== undefined ? this : globalObject;
332  
333        if (!exports.is(esValue)) {
334          throw new TypeError("'get isMap' called on an object that is not a valid instance of HTMLImageElement.");
335        }
336  
337        ceReactionsPreSteps_helpers_custom_elements(globalObject);
338        try {
339          return esValue[implSymbol].hasAttributeNS(null, "ismap");
340        } finally {
341          ceReactionsPostSteps_helpers_custom_elements(globalObject);
342        }
343      }
344  
345      set isMap(V) {
346        const esValue = this !== null && this !== undefined ? this : globalObject;
347  
348        if (!exports.is(esValue)) {
349          throw new TypeError("'set isMap' called on an object that is not a valid instance of HTMLImageElement.");
350        }
351  
352        V = conversions["boolean"](V, {
353          context: "Failed to set the 'isMap' property on 'HTMLImageElement': The provided value"
354        });
355  
356        ceReactionsPreSteps_helpers_custom_elements(globalObject);
357        try {
358          if (V) {
359            esValue[implSymbol].setAttributeNS(null, "ismap", "");
360          } else {
361            esValue[implSymbol].removeAttributeNS(null, "ismap");
362          }
363        } finally {
364          ceReactionsPostSteps_helpers_custom_elements(globalObject);
365        }
366      }
367  
368      get width() {
369        const esValue = this !== null && this !== undefined ? this : globalObject;
370  
371        if (!exports.is(esValue)) {
372          throw new TypeError("'get width' called on an object that is not a valid instance of HTMLImageElement.");
373        }
374  
375        ceReactionsPreSteps_helpers_custom_elements(globalObject);
376        try {
377          return esValue[implSymbol]["width"];
378        } finally {
379          ceReactionsPostSteps_helpers_custom_elements(globalObject);
380        }
381      }
382  
383      set width(V) {
384        const esValue = this !== null && this !== undefined ? this : globalObject;
385  
386        if (!exports.is(esValue)) {
387          throw new TypeError("'set width' called on an object that is not a valid instance of HTMLImageElement.");
388        }
389  
390        V = conversions["unsigned long"](V, {
391          context: "Failed to set the 'width' property on 'HTMLImageElement': The provided value"
392        });
393  
394        ceReactionsPreSteps_helpers_custom_elements(globalObject);
395        try {
396          esValue[implSymbol]["width"] = V;
397        } finally {
398          ceReactionsPostSteps_helpers_custom_elements(globalObject);
399        }
400      }
401  
402      get height() {
403        const esValue = this !== null && this !== undefined ? this : globalObject;
404  
405        if (!exports.is(esValue)) {
406          throw new TypeError("'get height' called on an object that is not a valid instance of HTMLImageElement.");
407        }
408  
409        ceReactionsPreSteps_helpers_custom_elements(globalObject);
410        try {
411          return esValue[implSymbol]["height"];
412        } finally {
413          ceReactionsPostSteps_helpers_custom_elements(globalObject);
414        }
415      }
416  
417      set height(V) {
418        const esValue = this !== null && this !== undefined ? this : globalObject;
419  
420        if (!exports.is(esValue)) {
421          throw new TypeError("'set height' called on an object that is not a valid instance of HTMLImageElement.");
422        }
423  
424        V = conversions["unsigned long"](V, {
425          context: "Failed to set the 'height' property on 'HTMLImageElement': The provided value"
426        });
427  
428        ceReactionsPreSteps_helpers_custom_elements(globalObject);
429        try {
430          esValue[implSymbol]["height"] = V;
431        } finally {
432          ceReactionsPostSteps_helpers_custom_elements(globalObject);
433        }
434      }
435  
436      get naturalWidth() {
437        const esValue = this !== null && this !== undefined ? this : globalObject;
438  
439        if (!exports.is(esValue)) {
440          throw new TypeError("'get naturalWidth' called on an object that is not a valid instance of HTMLImageElement.");
441        }
442  
443        return esValue[implSymbol]["naturalWidth"];
444      }
445  
446      get naturalHeight() {
447        const esValue = this !== null && this !== undefined ? this : globalObject;
448  
449        if (!exports.is(esValue)) {
450          throw new TypeError(
451            "'get naturalHeight' called on an object that is not a valid instance of HTMLImageElement."
452          );
453        }
454  
455        return esValue[implSymbol]["naturalHeight"];
456      }
457  
458      get complete() {
459        const esValue = this !== null && this !== undefined ? this : globalObject;
460  
461        if (!exports.is(esValue)) {
462          throw new TypeError("'get complete' called on an object that is not a valid instance of HTMLImageElement.");
463        }
464  
465        return esValue[implSymbol]["complete"];
466      }
467  
468      get currentSrc() {
469        const esValue = this !== null && this !== undefined ? this : globalObject;
470  
471        if (!exports.is(esValue)) {
472          throw new TypeError("'get currentSrc' called on an object that is not a valid instance of HTMLImageElement.");
473        }
474  
475        return esValue[implSymbol]["currentSrc"];
476      }
477  
478      get name() {
479        const esValue = this !== null && this !== undefined ? this : globalObject;
480  
481        if (!exports.is(esValue)) {
482          throw new TypeError("'get name' called on an object that is not a valid instance of HTMLImageElement.");
483        }
484  
485        ceReactionsPreSteps_helpers_custom_elements(globalObject);
486        try {
487          const value = esValue[implSymbol].getAttributeNS(null, "name");
488          return value === null ? "" : value;
489        } finally {
490          ceReactionsPostSteps_helpers_custom_elements(globalObject);
491        }
492      }
493  
494      set name(V) {
495        const esValue = this !== null && this !== undefined ? this : globalObject;
496  
497        if (!exports.is(esValue)) {
498          throw new TypeError("'set name' called on an object that is not a valid instance of HTMLImageElement.");
499        }
500  
501        V = conversions["DOMString"](V, {
502          context: "Failed to set the 'name' property on 'HTMLImageElement': The provided value"
503        });
504  
505        ceReactionsPreSteps_helpers_custom_elements(globalObject);
506        try {
507          esValue[implSymbol].setAttributeNS(null, "name", V);
508        } finally {
509          ceReactionsPostSteps_helpers_custom_elements(globalObject);
510        }
511      }
512  
513      get lowsrc() {
514        const esValue = this !== null && this !== undefined ? this : globalObject;
515  
516        if (!exports.is(esValue)) {
517          throw new TypeError("'get lowsrc' called on an object that is not a valid instance of HTMLImageElement.");
518        }
519  
520        ceReactionsPreSteps_helpers_custom_elements(globalObject);
521        try {
522          const value = esValue[implSymbol].getAttributeNS(null, "lowsrc");
523          if (value === null) {
524            return "";
525          }
526          const urlRecord = parseURLToResultingURLRecord_helpers_document_base_url(
527            value,
528            esValue[implSymbol]._ownerDocument
529          );
530          if (urlRecord !== null) {
531            return serializeURLwhatwg_url(urlRecord);
532          }
533          return conversions.USVString(value);
534        } finally {
535          ceReactionsPostSteps_helpers_custom_elements(globalObject);
536        }
537      }
538  
539      set lowsrc(V) {
540        const esValue = this !== null && this !== undefined ? this : globalObject;
541  
542        if (!exports.is(esValue)) {
543          throw new TypeError("'set lowsrc' called on an object that is not a valid instance of HTMLImageElement.");
544        }
545  
546        V = conversions["USVString"](V, {
547          context: "Failed to set the 'lowsrc' property on 'HTMLImageElement': The provided value"
548        });
549  
550        ceReactionsPreSteps_helpers_custom_elements(globalObject);
551        try {
552          esValue[implSymbol].setAttributeNS(null, "lowsrc", V);
553        } finally {
554          ceReactionsPostSteps_helpers_custom_elements(globalObject);
555        }
556      }
557  
558      get align() {
559        const esValue = this !== null && this !== undefined ? this : globalObject;
560  
561        if (!exports.is(esValue)) {
562          throw new TypeError("'get align' called on an object that is not a valid instance of HTMLImageElement.");
563        }
564  
565        ceReactionsPreSteps_helpers_custom_elements(globalObject);
566        try {
567          const value = esValue[implSymbol].getAttributeNS(null, "align");
568          return value === null ? "" : value;
569        } finally {
570          ceReactionsPostSteps_helpers_custom_elements(globalObject);
571        }
572      }
573  
574      set align(V) {
575        const esValue = this !== null && this !== undefined ? this : globalObject;
576  
577        if (!exports.is(esValue)) {
578          throw new TypeError("'set align' called on an object that is not a valid instance of HTMLImageElement.");
579        }
580  
581        V = conversions["DOMString"](V, {
582          context: "Failed to set the 'align' property on 'HTMLImageElement': The provided value"
583        });
584  
585        ceReactionsPreSteps_helpers_custom_elements(globalObject);
586        try {
587          esValue[implSymbol].setAttributeNS(null, "align", V);
588        } finally {
589          ceReactionsPostSteps_helpers_custom_elements(globalObject);
590        }
591      }
592  
593      get hspace() {
594        const esValue = this !== null && this !== undefined ? this : globalObject;
595  
596        if (!exports.is(esValue)) {
597          throw new TypeError("'get hspace' called on an object that is not a valid instance of HTMLImageElement.");
598        }
599  
600        ceReactionsPreSteps_helpers_custom_elements(globalObject);
601        try {
602          let value = esValue[implSymbol].getAttributeNS(null, "hspace");
603          if (value === null) {
604            return 0;
605          }
606          value = parseNonNegativeInteger_helpers_strings(value);
607          return value !== null && value >= 0 && value <= 2147483647 ? value : 0;
608        } finally {
609          ceReactionsPostSteps_helpers_custom_elements(globalObject);
610        }
611      }
612  
613      set hspace(V) {
614        const esValue = this !== null && this !== undefined ? this : globalObject;
615  
616        if (!exports.is(esValue)) {
617          throw new TypeError("'set hspace' called on an object that is not a valid instance of HTMLImageElement.");
618        }
619  
620        V = conversions["unsigned long"](V, {
621          context: "Failed to set the 'hspace' property on 'HTMLImageElement': The provided value"
622        });
623  
624        ceReactionsPreSteps_helpers_custom_elements(globalObject);
625        try {
626          const n = V <= 2147483647 ? V : 0;
627          esValue[implSymbol].setAttributeNS(null, "hspace", String(n));
628        } finally {
629          ceReactionsPostSteps_helpers_custom_elements(globalObject);
630        }
631      }
632  
633      get vspace() {
634        const esValue = this !== null && this !== undefined ? this : globalObject;
635  
636        if (!exports.is(esValue)) {
637          throw new TypeError("'get vspace' called on an object that is not a valid instance of HTMLImageElement.");
638        }
639  
640        ceReactionsPreSteps_helpers_custom_elements(globalObject);
641        try {
642          let value = esValue[implSymbol].getAttributeNS(null, "vspace");
643          if (value === null) {
644            return 0;
645          }
646          value = parseNonNegativeInteger_helpers_strings(value);
647          return value !== null && value >= 0 && value <= 2147483647 ? value : 0;
648        } finally {
649          ceReactionsPostSteps_helpers_custom_elements(globalObject);
650        }
651      }
652  
653      set vspace(V) {
654        const esValue = this !== null && this !== undefined ? this : globalObject;
655  
656        if (!exports.is(esValue)) {
657          throw new TypeError("'set vspace' called on an object that is not a valid instance of HTMLImageElement.");
658        }
659  
660        V = conversions["unsigned long"](V, {
661          context: "Failed to set the 'vspace' property on 'HTMLImageElement': The provided value"
662        });
663  
664        ceReactionsPreSteps_helpers_custom_elements(globalObject);
665        try {
666          const n = V <= 2147483647 ? V : 0;
667          esValue[implSymbol].setAttributeNS(null, "vspace", String(n));
668        } finally {
669          ceReactionsPostSteps_helpers_custom_elements(globalObject);
670        }
671      }
672  
673      get longDesc() {
674        const esValue = this !== null && this !== undefined ? this : globalObject;
675  
676        if (!exports.is(esValue)) {
677          throw new TypeError("'get longDesc' called on an object that is not a valid instance of HTMLImageElement.");
678        }
679  
680        ceReactionsPreSteps_helpers_custom_elements(globalObject);
681        try {
682          const value = esValue[implSymbol].getAttributeNS(null, "longdesc");
683          if (value === null) {
684            return "";
685          }
686          const urlRecord = parseURLToResultingURLRecord_helpers_document_base_url(
687            value,
688            esValue[implSymbol]._ownerDocument
689          );
690          if (urlRecord !== null) {
691            return serializeURLwhatwg_url(urlRecord);
692          }
693          return conversions.USVString(value);
694        } finally {
695          ceReactionsPostSteps_helpers_custom_elements(globalObject);
696        }
697      }
698  
699      set longDesc(V) {
700        const esValue = this !== null && this !== undefined ? this : globalObject;
701  
702        if (!exports.is(esValue)) {
703          throw new TypeError("'set longDesc' called on an object that is not a valid instance of HTMLImageElement.");
704        }
705  
706        V = conversions["USVString"](V, {
707          context: "Failed to set the 'longDesc' property on 'HTMLImageElement': The provided value"
708        });
709  
710        ceReactionsPreSteps_helpers_custom_elements(globalObject);
711        try {
712          esValue[implSymbol].setAttributeNS(null, "longdesc", V);
713        } finally {
714          ceReactionsPostSteps_helpers_custom_elements(globalObject);
715        }
716      }
717  
718      get border() {
719        const esValue = this !== null && this !== undefined ? this : globalObject;
720  
721        if (!exports.is(esValue)) {
722          throw new TypeError("'get border' called on an object that is not a valid instance of HTMLImageElement.");
723        }
724  
725        ceReactionsPreSteps_helpers_custom_elements(globalObject);
726        try {
727          const value = esValue[implSymbol].getAttributeNS(null, "border");
728          return value === null ? "" : value;
729        } finally {
730          ceReactionsPostSteps_helpers_custom_elements(globalObject);
731        }
732      }
733  
734      set border(V) {
735        const esValue = this !== null && this !== undefined ? this : globalObject;
736  
737        if (!exports.is(esValue)) {
738          throw new TypeError("'set border' called on an object that is not a valid instance of HTMLImageElement.");
739        }
740  
741        V = conversions["DOMString"](V, {
742          context: "Failed to set the 'border' property on 'HTMLImageElement': The provided value",
743          treatNullAsEmptyString: true
744        });
745  
746        ceReactionsPreSteps_helpers_custom_elements(globalObject);
747        try {
748          esValue[implSymbol].setAttributeNS(null, "border", V);
749        } finally {
750          ceReactionsPostSteps_helpers_custom_elements(globalObject);
751        }
752      }
753    }
754    Object.defineProperties(HTMLImageElement.prototype, {
755      alt: { enumerable: true },
756      src: { enumerable: true },
757      srcset: { enumerable: true },
758      sizes: { enumerable: true },
759      crossOrigin: { enumerable: true },
760      useMap: { enumerable: true },
761      isMap: { enumerable: true },
762      width: { enumerable: true },
763      height: { enumerable: true },
764      naturalWidth: { enumerable: true },
765      naturalHeight: { enumerable: true },
766      complete: { enumerable: true },
767      currentSrc: { enumerable: true },
768      name: { enumerable: true },
769      lowsrc: { enumerable: true },
770      align: { enumerable: true },
771      hspace: { enumerable: true },
772      vspace: { enumerable: true },
773      longDesc: { enumerable: true },
774      border: { enumerable: true },
775      [Symbol.toStringTag]: { value: "HTMLImageElement", configurable: true }
776    });
777    if (globalObject[ctorRegistrySymbol] === undefined) {
778      globalObject[ctorRegistrySymbol] = Object.create(null);
779    }
780    globalObject[ctorRegistrySymbol][interfaceName] = HTMLImageElement;
781  
782    Object.defineProperty(globalObject, interfaceName, {
783      configurable: true,
784      writable: true,
785      value: HTMLImageElement
786    });
787  };
788  
789  const Impl = require("../nodes/HTMLImageElement-impl.js");