tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTMLImageElement.html (3307B)


      1 <!DOCTYPE html>
      2 <title>Custom Elements: CEReactions on HTMLImageElement interface</title>
      3 <link rel="author" title="Intel" href="http://www.intel.com">
      4 <meta name="assert" content="alt, src, srcset, sizes, crossOrigin, useMap,
      5  isMap, width, height, referrerPolicy, decoding of
      6  HTMLImageElement interface must have CEReactions">
      7 <meta name="help" content="https://html.spec.whatwg.org/#the-img-element">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="../../resources/custom-elements-helpers.js"></script>
     11 <script src="../resources/reactions.js"></script>
     12 
     13 <map name="yellow"></map>
     14 <map name="green"></map>
     15 <a href="/" id="a">
     16 </a>
     17 <body>
     18 <script>
     19 
     20 function getParentElement() {
     21  return document.body;
     22 }
     23 
     24 function setAttributes(instance) {
     25  instance.setAttribute('src', '/images/green-1x1.png');
     26 }
     27 
     28 testReflectAttributeWithDependentAttributes(
     29  'alt', 'alt', 'image1',
     30  'image2', 'alt on HTMLImageElement', 'img',
     31  getParentElement, instance => setAttributes(instance), HTMLImageElement
     32 );
     33 testReflectAttributeWithParentNode(
     34  'src', 'src', '/images/green-1x1.png',
     35  '/images/green-2x2.png', 'src on HTMLImageElement', 'img',
     36  getParentElement, HTMLImageElement
     37 );
     38 testReflectAttributeWithDependentAttributes(
     39  'srcset', 'srcset', '/images/green.png',
     40  '/images/green-2x2.png', 'srcset on HTMLImageElement', 'img',
     41  getParentElement, instance => setAttributes(instance), HTMLImageElement
     42 );
     43 testReflectAttributeWithDependentAttributes(
     44  'sizes', 'sizes', '(max-width: 32px) 28px',
     45  '(max-width: 48px) 44px', 'sizes on HTMLImageElement', 'img',
     46  getParentElement, instance => {
     47    instance.setAttribute('src', '/images/green-1x1.png');
     48    instance.setAttribute('srcset', '/images/green-2x2.png 1x');
     49  }, HTMLImageElement
     50 );
     51 testReflectAttributeWithDependentAttributes(
     52  'crossOrigin', 'crossorigin', 'use-credentials',
     53  'anonymous', 'crossOrigin on HTMLImageElement', 'img',
     54  getParentElement, instance => setAttributes(instance), HTMLImageElement
     55 );
     56 testReflectAttributeWithDependentAttributes(
     57  'useMap', 'usemap', '#yellow',
     58  '#green', 'useMap on HTMLImageElement', 'img',
     59  getParentElement, instance => setAttributes(instance), HTMLImageElement
     60 );
     61 testReflectBooleanAttributeWithDependentAttributes(
     62  'isMap', 'ismap', 'isMap on HTMLImageElement',
     63  'img', () => { return document.getElementById('a') },
     64  instance => setAttributes(instance),
     65  HTMLImageElement
     66 );
     67 testReflectAttributeWithDependentAttributes(
     68  'width', 'width', '1',
     69  '2', 'width on HTMLImageElement', 'img',
     70  getParentElement, instance => setAttributes(instance), HTMLImageElement
     71 );
     72 testReflectAttributeWithDependentAttributes(
     73  'height', 'height', '1',
     74  '2', 'height on HTMLImageElement', 'img',
     75  getParentElement, instance => setAttributes(instance), HTMLImageElement
     76 );
     77 testReflectAttributeWithDependentAttributes(
     78  'referrerPolicy', 'referrerpolicy', 'same-origin',
     79  'origin', 'referrerPolicy on HTMLImageElement', 'img',
     80  getParentElement, instance => setAttributes(instance), HTMLImageElement
     81 );
     82 testReflectAttributeWithDependentAttributes(
     83  'decoding', 'decoding', 'async',
     84  'sync', 'decoding on HTMLImageElement', 'img',
     85  getParentElement, instance => setAttributes(instance), HTMLImageElement
     86 );
     87 
     88 </script>
     89 </body>