HTMLButtonElement.html (2816B)
1 <!DOCTYPE html> 2 <title>Custom Elements: CEReactions on HTMLButtonElement interface</title> 3 <meta name="author" title="Zhang Xiaoyu" href="xiaoyux.zhang@intel.com"> 4 <meta name="assert" content=" autofocus, disabled, formAction, formEnctype, 5 formMethod, formNoValidate, formTarget, name, type, value 6 of HTMLButtonElement interface must have CEReactions"> 7 <meta name="help" content="https://html.spec.whatwg.org/#htmlbuttonelement"> 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 <body> 13 <script> 14 15 function getParentElement(parentElementName) { 16 let parentElement = document.createElement(parentElementName); 17 document.body.appendChild(parentElement); 18 return parentElement; 19 } 20 21 function setAttributes(instance) { 22 instance.setAttribute('type', 'submit'); 23 } 24 25 testReflectBooleanAttribute( 26 'autofocus', 'autofocus', 'autofocus on HTMLButtonElement', 27 'button', HTMLButtonElement 28 ); 29 testReflectBooleanAttribute( 30 'disabled', 'disabled','disabled on HTMLButtonElement', 31 'button', HTMLButtonElement 32 ); 33 testReflectAttribute( 34 'name', 'name', 'intel', 35 'intel1', 'name on HTMLButtonElement', 'button', 36 HTMLButtonElement 37 ); 38 testReflectAttribute( 39 'value', 'value', 'HTML', 40 'CSS', 'value on HTMLButtonElement', 'button', 41 HTMLButtonElement 42 ); 43 testReflectAttributeWithParentNode( 44 'type', 'type', 'submit', 45 'reset', 'type on HTMLButtonElement', 'button', 46 () => getParentElement('form'), HTMLButtonElement 47 ); 48 testReflectAttributeWithDependentAttributes( 49 'formAction', 'formaction', 'intel.asp', 50 'intel1.asp', 'formAction on HTMLButtonElement', 'button', 51 () => getParentElement('form'), instance => setAttributes(instance), 52 HTMLButtonElement 53 ); 54 testReflectAttributeWithDependentAttributes( 55 'formEnctype', 'formenctype', 'text/plain', 'multipart/form-data', 56 'formEnctype on HTMLButtonElement', 'button', () => getParentElement('form'), 57 instance => setAttributes(instance), 58 HTMLButtonElement 59 ); 60 testReflectAttributeWithDependentAttributes( 61 'formMethod', 'formmethod', 'get', 62 'post', 'formMethod on HTMLButtonElement', 'button', 63 () => getParentElement('form'), instance => setAttributes(instance), 64 HTMLButtonElement 65 ); 66 testReflectBooleanAttributeWithDependentAttributes( 67 'formNoValidate', 'formnovalidate', 'formNoValidate on HTMLButtonElement', 68 'button', () => getParentElement('form'), 69 instance => setAttributes(instance), 70 HTMLButtonElement 71 ); 72 testReflectAttributeWithDependentAttributes( 73 'formTarget', 'formtarget', '_blank', 74 '_self', 'formTarget on HTMLButtonElement', 'button', 75 () => getParentElement('form'), instance => setAttributes(instance), 76 HTMLButtonElement 77 ); 78 79 </script> 80 </body>