HTML Element
devdocs: https://devdocs.io/dom/htmlelement
MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
์์ ๋ฐ๋ผํ๊ธฐ: https://codesandbox.io/s/staging-feather-jthzn / https://jthzn.csb.app/
HTML Element ์ธํฐํ์ด์ค๋ ๋ชจ๋ ์ข ๋ฅ์ HTML element๋ฅผ ๋ํ๋ธ๋ค.(?) ์ด๋ค elements ์ง์ ์ ์ผ๋ก ์ด ์ธํฐํ์ด์ค๋ฅผ ๊ตฌํํ๋ ๋ฐ๋ฉด, ๋ค๋ฅธ element๋ค์ ๊ทธ๊ฒ์ ์์ํ๋ ์ธํฐํ์ด์ค๋ฅผ ํตํด ๊ตฌํํ๋ค.
Properties
๋ถ๋ชจ์ธ Element์ ์์ฑ์ ์์ํ๋ค. DocumentAndElementEventHandlers, ElementCssInlineStyle, GlobalEventHandlers, HTMLOrForeignElement, TouchEventHandlers์ ์์ฑ์ ๊ตฌํํ๋ค.
HTMLElement.accessKey
์์์ ํ ๋น๋ accessKey๋ฅผ ๋ํ๋ด๋ DOMString ์ด๋ค.
accessKey๊ฐ ๋ญ๊ฐ ํ๋๋ ๋จ์ถํค?
accessKey: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey Mac์์๋ control + option + key๋ฅผ ํ์ ๋ ์์ฑ์ด ๋จนํ๋ค.
HTMLElement.accessKeyLabel (Read only)
์์์ ํ ๋น๋ accessKey๋ฅผ ํฌํจํ๋ DOMString์ ๋ฐํํ๋ค. ์กด์ฌํ์ง ์๋ ๊ฒฝ์ฐ ๋น๋ฌธ์์ด์ ๋ฐํํ๋ค.
Syntax
label = element.accessKeyLabelExample
<body> <div id="app"> <button accesskey="h" title="Caption" id="btn1">Hover me</button> </div> <script> const node = document.querySelector("#btn1"); if (node.accessKeyLabel) { console.log("1"); node.title += " [" + node.accessKeyLabel + "]"; } else { console.log("2"); node.title += " [" + node.accessKey + "]"; } node.onclick = function() { const p = document.createElement("p"); p.textContent = "Clicked!"; node.parentNode.appendChild(p); }; </script> </body>์๊ธฐ๋ค. ์์ ๋ผ๊ณ ๋ฐ๋ผํ๋๋ฐ ๋ฌด์กฐ๊ฑด
if (node.accessKeyLabel)์ด ์กฐ๊ฑด๋ฌธ์์ false๋ฅผ ํ๊ณ ์ฝ๋๋ฅผ ์น ๋ accessKeyLabel์ด ์๋์์ฑ์ผ๋ก ์๋ฌ๋ค. https://codesandbox.io/s/staging-feather-jthznHTMLElement.contentEditable
์ด๊ฒ์ DOMString์ด๊ณ element๋ ์์ ๊ฐ๋ฅ ํ๋ค๋ฉด true, ๊ทธ๋ ์ง์๋ค๋ฉด false ๊ทผ๋ฐ DOMString inherit๋ ๋ถ๋ชจ์ ์์ ๊ฐ๋ฅํ ์ํ๋ฅผ ์์ํ๋ค.
HTMLElement.isContentEditable
์์์ ์์ ์ฌ๋ถ๋ฅผ boolean์ผ๋ก return ํด์ค๋ค. flag๋ ์ง์ง is๋ก ์์..
syntax
editable = element.isContentEditableExample
<body> <p class="p1">p1</p> <p class="p2" contenteditable="true">p2</p> <script> const p1 = document.querySelector(".p1"); const p2 = document.querySelector(".p2"); console.log("p1.isContentEditable", p1.isContentEditable); // false console.log("p1.isContentEditable", p2.isContentEditable); // true console.log("typeof", typeof p2.isContentEditable); // 'boolean' </script> </body>HTMLElement.contextMenu
๋์ด์ ์ฌ์ฉ๋๋ฉด ์๋์ง๋ง ์๋ง ์ฌ์ฉ๋๊ณ ์์ ๊ฒ์ด๋ค. element์ ๊ด๋ จ๋ contextual menu๋ฅผ ๋ํ๋ด๋ HTMMenuElement์ด๋ค. ์๋ง๋ null..
HTMLElementOrForeignElement.dataset (READ ONLY)
custom data attributes (
data-*) element๋ฅผ script์์ ์ฝ๊ณ ์ธ ์ ์๋ DomStringMap์ผ๋ก return ํด์ค๋ค. ์ด Access๋ DOM๊ณผ HTML ์์ ๊ฐ๋ฅํ๋ค. ์ฝ๊ธฐ๋ง ๊ฐ๋ฅํ๊ณ ์ง์ ์ธ ์ ์๋ค. data- data- ์์ํด์ผํ๋ค.html: ๋ฌธ์, ์ซ์ ๋์(-), ์ (.), ์ฝ๋ก (:), ์ธ๋์ค์ฝ์ด(_) ๋ ์ฌ์ฉ๊ฐ๋ฅํ์ง๋ง ๋๋ฌธ์๋ ์ฌ์ฉํ ์ ์๋ค.
javascript: ์นด๋ฉ์ผ์ด์ค๋ก ์ฐ๊ณ ๋์ ์ ๋ฑ์ ๋ชจ๋ ์ ๊ฑฐ ๋ค์ ์ปจ๋ฒค์ dash-style -> camelCase ๋ก ๋ณํ, ์ด ๊ท์น๋๋ก DOMStringMap์ Key๋ก ๋ณํ๋๋ค.
์ ๋์ด data-๋ ์ญ์ ๋๋ค.
a-z๊น์ง ์๋ฌธ์ ์์ ์ค๋ ๋ชจ๋ ๋์๋ ์ญ์ , ์๋ฌธ์๋ -> ๋๋ฌธ์๋ก
camelCase -> dash-style๋ก ๋ณํ
๋ณํ์ a-z ์๋ฌธ์๋ก ์ธ ์ ์๋ค.
dash-๊ฐ ์ถ๊ฐ๋๋ค.
๋๋ฌธ์๋ ์๋ฌธ์๋ก ๋ณํ๋๋ค.
๋ค๋ฅธ ๋ฌธ์๋ ๋ณํ๋์ง ์๋๋ค.
value์ ์ ๊ทผํ๊ธฐ
element.dataset.keyname ๊ณผ ๊ฐ์ด camelCase key๋ฅผ ์ฌ์ฉํด์ ์ค์ ํ๊ฑฐ๋ ์ฝ์ ์ ์๋ค.
element.dataset[keyname] ๋ ๊ฐ๋ฅ
in operator๋ฅผ ์ด์ฉํ์ฌ attribute์ ์กด์ฌ์ฌ๋ถ๋ฅผ ์ ์ ์๋ค.
value๋ฅผ ์ค์ ํ๊ธฐ
value๊ฐ ์ค์ ๋๋ฉด ํญ์ ๋ฌธ์์ด์ด๋ค.
delete operator๋ฅผ ์ฌ๊ธฐ์๋ ์ฌ์ฉํ ์ ์๋ค.
syntax
const dataAttrMap = element.datasetreturn value
A DOMStringMap.
<div id="user" data-id="1234567890" data-user="sla" data-data-of-birth>sla</div>const el = document.querySelector('#user'); console.log('user' in el.dataset); // true el.dataset.dataOfBirth = '04-27'; delete el.dataset.id; console.log('id', 'id' in el.dataset); // false el.dataset.someDataAttr = 'mydata' console.log('someDataAttr', 'someDataAttr' in el.dataset); // tureํ.. ์ ๋ฐ ๋ค์ ์ปจ๋ฒค์ ์ด ์๋ ์ค ๋ชฐ๋๋น.
HTMLElement.dir
๋ฐฉํฅ์ ๋ํ๋ด๋ global attribute๋ฅผ DOMString์ผ๋ก ๋ฐํํ๋ค. ๊ฐ๋ฅํ ๊ฐ์ "ltr", "rtl", "auto"์ด๋ค. ํ ์คํธ๋ฅผ ์ฐ๋ ๋ฐฉํฅ์ ์ค์ ํ๊ฑฐ๋ ๊ฐ์ ธ์ฌ ๋ ์ ์ฉํ๋ค. ์๋์ด์ ํ๋ธ๋ฆฌ์ด๋ RTL ๋ฐฉํฅ์ฑ์ ์ฌ์ฉํ๋ ๋ํ์ ์ธ ์ธ์ด์ด๋ค. ์ด๋ฏธ์ง์ ์์ฑ์ผ๋ก๋ ์ฌ์ฉํ ์ ์๋ค. title๊ณผ alt๊ฐ rtl ํฌ๋งท์ผ๋ก ์ ์๋๋ค. ๐ ํ ์ด๋ธ์์ ์ ์๋ ๊ฒฝ์ฐ ์ด์ ์์๊ฐ ์ค๋ฅธ์ชฝ์์ ์ผ์ชฝ์ผ๋ก ๋ฐฐ์ด๋๋ค.
auto๋ก ์ค์ ๋์ด ์๋๊ฒฝ์ฐ ์ฒซ๋ฒ์งธ ๋ฌธ์๋ ๋ถ๋ชจ์์์ ๋ฐฉํฅ์ฑ์ ๊ธฐ์ค์ผ๋ก ํ๋ค.
Syntax
let currentWritingDirection = elementNodeReference.dir; elementNodeReference.dir = newWritingDirection;currentWritingDirection๋ ํ์ฌ element์ ํ ์คํธ ์ฐ๊ธฐ ๋ฐฉํฅ์ ๋ํ๋ด๋ ๋ฌธ์์ด ๋ณ์์ด๋ค.newWritingDirection์ ํ ์คํธ ์ฐ๊ธฐ ๋ฐฉํฅ์ ๊ฐ์ ๋ํ๋ด๋ ๋ฌธ์์ด ๊ฐ์ด๋ค.
'ltr' -> left to right
'rtl' -> right to left
'auto' -> element์ content์ ๋ฐ๋ผ ๊ฒฐ์ ๋์ด์ผ ํ๋ค.
<div class="name">my name is sla</div>const el = document.querySelector(".name"); el.dir = "rtl";์ผ๋จ ์ค๋ฅธ์ชฝ ๋์ ๋ถ์ ์ ๋ ฌ์ด ๋์.. ๐ค
์ํผ ์ด๋ฐ๊ฒ ์์๋ค๋.. ๐คญ
HTMLElement.draggable ์์๊ฐ drag๊ฐ ๊ฐ๋ฅํ์ง Boolean์ผ๋ก ๋ฐํํ๋ค.
HTMLElement.dropzone dropzone์ด ๋์ด์ ์ฐ์ด์ง ์๋๋ค. ๋ชจ๋ ๋ธ๋ผ์ฐ์ ๊ฐ ์ง์ํ์ง ์์.
HTMLElement.hidden
element๊ฐ hidden์ธ์ง ์๋์ง๋ฅผ Boolean ๊ฐ์ผ๋ก ๋ํ๋ธ๋ค. ๋ชจ๋ presentation mode์์ ์ ์ฉ๋๋ค. ์ฌ์ฉ์๊ฐ ์ ๊ทผ ํ ์ ์๋๋ก ๋์ด ์๋ ์ฝํ ์ธ ๋ฅผ ์จ๊ธฐ๊ธฐ ์ํด ์ฌ์ฉํด์๋ ์๋๋ค. css์ display๋ฅผ ์ฌ์ฉํด์ ์ ์ดํ๋๊ฒ๊ณผ ๋ค๋ฅด๋ค. hidden์ ์ ์ ํ ์ฌ์ฉ ์ฌ๋ก
ํ์ฌ๋ ๊ด๋ จ์ด ์์ง๋ง ๋์ค์ ํ์ํ ์ ์๋ ์ฝํ ์ธ
์ด์ ์ ํ์ํ์ง๋ง ๋ ์ด์ ํ์ํ์ง ์์ ์ฝํ ์ธ
ํ์ด์ง ๋ค๋ฅธ ๋ถ๋ถ์์ ํ ํ๋ฆฟ์ฒ๋ผ ์ฌ์ฌ์ฉ๋๋ ์ฝํ ์ธ (?)
drawing buffer offscreen canvas ๋ง๋ค๋?? drawing buffer์ ์ง์ง ๋ชจ๋ฅด๊ฒ ๋ค offscreen canvas: off screen ๋ ๋ ํ ์ ์๋ canvas๋ฅผ ์ ๊ณตํ๋ค. window์ worker context์์ ์ฌ์ฉํ ์ ์๋ค. web workers ๋จ์ผ ์ฐ๋ ๋์์ ์คํํ๊ณ ์ถ์ง ์์๋.. ๋ณ๋์ background thread์์ ์ฌ์ฉํ๊ณ ์ถ์๋
๋ถ์ ์ ํ ์ฌ์ฉ ์ฌ๋ก
tab์ด ์๋ dialog box ์์ pannel ์จ๊ธฐ๊ธฐ
ํ content์์ ํ presentation์ ์จ๊ธฐ๋ฉด์ ๋ค๋ฅธ presentation์ ๋ณผ ์ ์๊ฒ ํจ
โ ์๋ง ์ ๊ทผ์ฑ ๊ด๋ จ๋๊ฒ ์๋๊น ์๊ฐ์ด ๋ฌ.. ๋์ ๋ณด์ด์ง ์์ง๋ง ๋ฆฌ๋๊ธฐ๋ก ์ฝ์ ์ ์๋ ๊ทธ๋ฐ๊ฒ๋ค.. ๊ทธ๋์ ๋์๋ง ์๋ณด์ด๋๊ฒ hidden์ ์ฌ์ฉํ๋ ๊ณณ์ ์ง๊ธ์ ์ฌ์ฉํ์ง ์์ง๋ง ๋์ค์ ์ฌ์ฉ๋ , ํน์ ์ด์ ๋์ด์ ํ์์๋๊ฒ๋ค ํ์ ์ธ๊ฑฐ ๊ฐ๋ค. ์ด๋ด๋ css์์๋ฅผ ์ด์ฉํ๋ผ๋ ๋ป ๊ฐ์
Elements that are not hidden must not link to elements which are.
โHiddenโ ํด์ฃผ์ง ์์ ์์๋ โHiddenโํ ์์์ ์ฐ๊ฒฐ ์ํค์ง ์์์ผ ํ๋ค.
Syntax
isHidden = HTMLElement.hidden; HTMLElement.hidden = true | false;
Value
view์์ ์จ๊ฒจ์ ธ ์๋ค๋ฉด true, ์๋๋ฉด false
<div id="welcome" class="panel"> <h1>welcome</h1> <button class="button" id="okButton">OK</button> </div> <div id="awesome" class="panel" hidden> <h1>Thanks!</h1> <p>Thank you!</p> </div> document.querySelector("#okButton").addEventListener("click", function() { document.querySelector("#welcome").hidden = true; document.querySelector("#awesome").hidden = false; }, false);addEventListener์ 3๋ฒ์งธ ์ธ์๋ options
options
capture: DOM ํธ๋ฆฌ์ ํ๋จ์ ์๋ EventTarget ์ผ๋ก ์ ์กํ๊ธฐ ์ ์, ๋ฑ๋ก๋ listener ๋ก ์ด ํ์ ์ ์ด๋ฒคํธ์ ์ ์ก์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ Boolean ? ํ EventTarget๊ณผ CurrentTarget ์๊ธฐ์ธ๊ฐ.. EventTarget๋ ์ ์ด๊ฐ ๊ฐ๋ฅํ๊ตฌ๋..
once: ๋ฆฌ์ค๋๊ฐ ์ถ๊ฐํ ํ ํ๋ฒ๋ง ํธ์ถ
passive: ์ด๊ฑด ์ฒ์๋ณด๋ค.. true์ผ ๋ listener์์ ์ง์ ํ ํจ์๊ฐ preventDefault()๋ฅผ ํธ์ถํ์ง ์์์ ๋ํ๋ด๋ Boolean์ผ๋ก ๋ํ๋ธ๋ค.. ํ? ์ด๋ฐ๊ฒ..
useCapture ์์์ ์๋๋ก ํ๋ฅด๋ capture๊ณผ์
modern browsers๋ capture๋ผ๊ณ ๋ถ๋ฆฌ๋ ๊ฒ์ ํ๋ค.
element๋ฅผ ํด๋ฆญํ๋ฉด ๊ทธ๊ฒ์ ์์์ ์๋๋ก ํ๋ฌ๋ด๋ฆฐ๋ค.
๋ธ๋ผ์ฐ์ ๋ "๋ body๋ ํด๋ฆญํ๊ณ , one๋ ํด๋ฆญํ๊ณ two๋ ํด๋ฆญํ๊ณ three๋ ํด๋ฆญํ๋ค" ํ๊ณ ์ธ์ํ๋ค.
์ค์ ๋ก ์์์ ์๋๋ก ๋ด๋ ค๊ฐ๋ค๊ฐ, ๋ชจ๋ ์ด๋ฒคํธ๋ฅผ ๋ด๊ฐ ํด๋ฆญํ ๊ณณ์ "captures" ๋ฅผ ํ๊ณ ๋ณด๊ดํ๋ค.
ํ์ง๋ง ์ด๋ฒคํธ๋ ์คํ๋์ง ์๋๋ค. ๊ทธ๋ผ ์ด์ ํด๋ฆญํ ๊ณณ์์ "bubble Up"์ด ์ผ์ด๋๋ค.
User agent - ์ฌ์ฉ์๋ฅผ ๋์ ํ์ฌ ์ผ์ ์ํํ๋ ์ํํธ์จ์ด ์์ด์ ํธ์ด๋ค. ์๋ฅผ ๋ค์ด, ์ด๋ฉ์ผ ๋ฆฌ๋์์๋ ๋ฉ์ผ ์ฌ์ฉ์ ์์ด์ ํธ์ด๊ณ , ์ฌ์ฉ์ ์์ด์ ํธ๋ฅผ ๋ปํ๋ ์ฉ์ด์ธ ์ธ์ ๊ฐ์ ํ๋กํ ์ฝ์์๋ ํต์ ์ธ์ ์ ์ชฝ ๋์ ๋งํ๋ค.(wikipedia)
์ ์ ์์ด์ ํธ๊ฐ ์ฌ์ฉ์ ์ธํฐ๋ ์ ์ด๋ฒคํธ, ํ์ด์ง ๋ด ํ ์คํธ ๊ฒ์("ํ์ด์ง์์ ์ฐพ๊ธฐ"), ํ ์คํธ ์ ํ์ ๋ชฉ์ ์ผ๋ก ์ฃผ์ด์ง ๋ ธ๋๊ฐ ์๋ ๊ฒ์ฒ๋ผ ๋์ํด์ผํ๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ Boolean ์ ๋ฐํํฉ๋๋ค.
inert="true"element๊ฐ ๊ฐ์ง๊ณ ์๋ค๋ฉด browser๋ignoreํ๋ค.ํค๋ณด๋๋ก ์ด๋ํ๋ ์ฌ์ฉ์๊ฐ ์๋ค๊ณ ํ์
ํ๋ฒ๊ฑฐ ๋ฉ๋ด๊ฐ ์๊ณ โ ์ปจํ ์ธ ๋ก ์ด๋ํ๋๋ฐ ํ๋ฒ๊ฑฐ ๋ฉ๋ด ์์ ์๋ anchor tag ๋ค ์ด๋ํด์ผ ์ปจํ ์ธ ๋ก ์ด๋ํ๋ค.
์ด๋ฅผ ์ ์ดํ๊ณ ์ ํ ๋
inert๋ฅผ ์ฌ์ฉํ๊ฒ ๋๋ค.node์ ํ์ ์์์ rendered text ๋ด์ฉ์ ๋ํ๋ธ๋ค.
innerText์ textContent์ ์ฐจ์ด๊ฐ ์๋๋ฐ
innerText๋ rendered appearance๋ฅผ ์๊ณ ์๋ค.
<br>ํ๊ทธ๋ฅผ ๊ฐ์๊ฑธ ์ธ์ํ๊ณ , hidden elements๋ฅผ ๋ฌด์ํ๋ค.DOMString์ ๋ฐํ property element์ ์์์ text content์ ๊ธฐ๋ณธ์ธ์ด๋ฅผ get, get ๊ฐ๋ฅํ๋ค. Tags for Identifying Languages ์ ์๋ language code๋ฅผ return ํ๋ค. default value๋unknown์ด๋ค. Syntaxlet languageUsed = elementNodeReference.lang; // get elmentNodeReference.lang = NewLangyage; // setExample
document.documentElement.lang // getHTMLElement.noModule module scripts๋ฅผ ์ง์ํ๋ ์ ์ ์์ด์ ํธ์์ importํ script๋ฅผ ์คํํ ์ ์๋์ง ์ฌ๋ถ๋ฅผ ๋ํ๋ด๋ Boolean์ด๋ค.
Content Security Policy ์ ์ฌ์ฉํ๋ ํ๋ฒ๋ง ์ฌ์ฉํ ์ ์๋ ์ํธํ๋ ์ซ์๋ฅผ ๋ฆฌํดํ์ฌ ์ฃผ์ด์ง fetch์ ์งํ์ ํ์ฉํ ์ง ๋ง์ง ์ฌ๋ถ๋ฅผ ๊ฒฐ์ ํ๋ค. script์์๋ง nonce ์์ฑ์ด ๋ ธ์ถ๋๋ค. Examples
let nonce = script['nonce'] || script.getAttribute('nonce');getAttribute์ ์ด๊ฑด ๊ณผ๊ฑฐ ๋ธ๋ผ์ฐ์ ๋ค ์ฉ,
script['nonce']์ต์ ๋ธ๋ผ์ฐ์ ์ฉ์ด๋ค. ์ต๊ทผ ๋ถ๋ผ์ฐ์ ์์ accsessํ๋ ๋ฐฉ๋ฒ์script['nonce']์ด๋ ๊ฒ ๋ฐ์ ์๋ค. nonce ๋ฐ์ดํฐ๋ฅผ ์ ์ถํ๋ ๊ฒ์ ๋ฐฉ์งํ๋ ๋ฐ ๋์์ด ๋๋ค. https://stackoverflow.com/questions/42922784/what-s-the-purpose-of-the-html-nonce-attribute-for-script-and-style-elements ๋ ์ฝ์ ๊ฑฐ๋ฆฌ: https://developers.google.com/web/fundamentals/security/csp/#if_you_absolutely_must_use_itHTMLElement.spellcheck spell-checking ์ controlํ๋ Boolean์ด๋ค.. ๋ค? ์ด๋ฐ๊ฒ ์์๋ค๊ณ ์? ๐
htmlelement.style
CSSStyleDeclaration์ด๋ค. ์์์ ์ธ๋ผ์ธ ์คํ์ผ์ ์ค์ ํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ค. getํ ๋์๋ ์์์ ์ธ๋ผ์ธ ์คํ์ผ ์์ฑ์ ์ ์๋ ๋ชจ๋ ์คํ์ผ ์์ฑ์ ํฌํจํ๋ css์ ์ธ์ ๋ด์ CSSTyleDeclation ๊ฐ์ฒด๋ฅผ ๋ฐํํ๋ค.Setting ์ฝ๊ธฐ์ ์ฉ์ CSStyleDeclation ๊ฐ์ฒด๋ฅผ ๋ฐํํ๊ธฐ ๋๋ฌธ์ ๋ฌธ์์ด์ ์ง์ ํ ๋นํ๋ฉด ์๋๋ค.(elt.style = "color: red" ๊ฐ์ / elt.style.cssText = "color: blue; border: 1px solid black"; ์ด๋ ๊ฒ ํด์ผํ๋ค. ) ๋ง์ฝ ์คํ์ผ ์ ์๊ฐ ์ฌ๋ฌ๊ฐ ์์ ๋ ํน์ ์คํ์ผ๋ง ๋ณ๊ฒฝํ๊ณ ์ ํ๋ค๋ฉด ํน์ ์คํ์ผ์ ์ ๊ทผํด์ ๋ณ๊ฒฝํ๋๊ฒ ๋ฐ๋์งํ๋ค. (elt.style.color = "..." ๊ฐ์ด) ๋๋ ( ele.setAttribute('style', '...')) ์ฌ์ฉํ์ฌ ์์ ์ ์ฒด๋ฅผ ์ฌ์ ์ํ๋ค. kebab-case๊ฐ ์๋ calmel-case๋ก ๋์ด์๋ค. reset์ null์ด๋ ''๋น๋ฌธ์์ด ํ์ง๋ง IE๋ ''๋น๋ฌธ์์ด๋ง ๋จนํ๋ค.
// ์ฌ๋ฌ ์คํ์ผ์ ์ ์ ํ ๋. elt.style.cssText = "color: blue; border: 1px solid black"; // Or elt.setAttrubute("style", "color:red; border: 1px solid black"); // ํน์ ์คํ์ผ๋ง ๋ฐ๊ฟ ๋ elt.style.color = "blue";Getting ์ค์ง ์ธ๋ผ์ธ ์คํ์ผ๋ง ๊ฐ์ ธ์จ๋ค. section ์คํ์ผ ๊ท์น์ด๋ ์ธ๋ถ ์คํ์ผ sheet์ ๊ฐ์ ๋ค๋ฅธ ๊ท์น ์คํ์ผ์ ๊ฐ์ ธ์ค์ง ์๋๋ค. ์์์ ๋ชจ๋ ์คํ์ผ ์์๋ฅผ ๊ฐ์ ธ์ค๊ณ ์ถ๋ค๋ฉด
window.getComputedStyle()๋ฅผ ๋์ ์ฌ์ฉํ๋ผ!
Last updated
Was this helpful?