๐Ÿ“
til
  • TIL(Today I Learned)
  • javascript
    • value-number-string-boolean-null-undefined
    • primitive-reference
    • Hoisting
    • Prototypes in Javascript
    • this
    • prototype
    • ์ฝœ๋ฐฑํ•จ์ˆ˜ (Callback function)
    • ํ•จ์ˆ˜์˜ ํ˜ธ์ถœ
    • ์ž๋ฃŒ๊ตฌ์กฐ new keyword
    • closure
    • Promise
    • event-loop
    • array-object
    • ๊ฐ์ฒด
    • Arguments
    • higher order function
    • operators-function-control-flow
    • ๊ฐ์ฒด ์ƒ์„ฑ ํŒจํ„ด 3๊ฐ€์ง€
    • Javascript scopes
    • Functional Programming
    • Design Patterns
    • ๋ฐ์ดํ„ฐ ํƒ€์ž…
    • Object ๊ฐ์ฒด
    • ํ‘œ์ค€ ๋‚ด์žฅ ๊ฐ์ฒด์˜ ํ™•์žฅ
    • ์ฐธ์กฐ
    • ํ•จ์ˆ˜
    • ์ƒ์†(Inheritance)
    • this - 'this'๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ•ด๋‹น ํ•จ์ˆ˜๋ฅผ '์–ด๋–ป๊ฒŒ' ์‹คํ–‰ํ•˜๋А๋ƒ์— ๋”ฐ๋ฅธ 4๊ฐ€์ง€ this ์ •์˜
    • ์ „์—ญ๊ฐ์ฒด(Global object)
    • ๊ฐ์ฒด ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ
    • The 'new' keyword - Object Creation in JavaScript
  • javascript-api
    • Number
      • Number.MAX_VALUE
      • Number.isInteger
      • Number.NEGATIVE_INFINITY
      • Number.isNaN()
      • Number.POSITIVE_INFINITY
      • Number.parseFloat
      • Number.EPSILON
      • number.toExponential
      • Number.MAX_SAFE_INTEGER
      • Number1 - ์ž์—ฐ์ˆ˜, ์ •์ˆ˜, 10์ง„์ˆ˜, 2์ง„์ˆ˜, ๋ถ€๋™์†Œ์ˆ˜์ , ์‹ค์ˆ˜
      • Number.isSafeInteger()
      • Number.MIN_VALUE
      • Number.parseInt
      • Number.NaN
      • Number.isFinite()
      • Number.MIN_SAFE_INTEGER
      • toFixed
    • string.split
    • String.fromCodePoint
    • string.trimEnd
    • string.padStart
    • string.@@iterator
    • String.fromCharCode
    • string.toUpperCase
    • string.codePointAt
    • string.toLowerCase()
    • string.toString
    • string.includes
    • string.replace()
    • string.charAt
    • String.lastIndexOf
    • string.slice
    • string.search
    • string.padEnd
    • string.substring
    • string.length
    • string.trim
    • string.localeCompare
    • String.indexOf
    • string.endsWith
    • string.valueOf
    • String.raw
    • string.matchAll()
    • string.repeat
    • string.match
    • String.prototype
    • string.startsWith
    • string.charCodeAt
    • string.trimStart
    • string.concat
    • string.toLocaleUpperCase()
    • string.toLocaleLowerCase
    • String
  • learn-node
    • debugger
    • Tip
  • schema-design
    • Database Schema Design
    • Database Schema Design
  • react
    • LifeCycle
    • redux
    • Context API
    • ํ•จ์ˆ˜ํ˜• ์ปดํฌ๋„ŒํŠธ์™€ ํด๋ž˜์Šค, ์–ด๋–ค ์ฐจ์ด๊ฐ€ ์กด์žฌํ• ๊นŒ?
    • Hooks๊ณผ useEffect ์‚ฌ์šฉํ•ด ๋ณด๊ธฐ
    • Route
    • async wait ์‚ฌ์šฉํ•˜๊ธฐ
    • Hooks API Reference
    • context
    • npm uninstall ํ•˜๋Š”๋ฒ•
    • test ๋งŒ๋“ค๊ธฐ
  • tip
    • ํด๋ฆฐ์ฝ”๋“œ
    • BxSlider๋กœ ํ…์ŠคํŠธ ํ๋ฅด๋Š” ํšจ๊ณผ ๋งŒ๋“ค๊ธฐ
  • javascript30
    • Event Capture, Propagation, Bubbling and Once
    • Object and Arrays - Reference VS Copy
  • typescript
    • ์šฐ์•„ํ•œ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ 2๋ถ€
    • The Basic Cheatsheet
    • TypeScript
    • Type Guards and Differnetiating Types
    • ์šฐ์•„ํ•œ ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ
    • Generics
  • git-from-the-hell
    • git
    • init-status-add-commit-log-stage-repository
    • log-diff
    • ๋จธ์ง€ ํ›„ branch ์‚ญ์ œํ•˜๊ธฐ
    • ์ง€์˜ฅ์—์„œ ์˜จ Git
    • reset-revert
    • develop branch ๋ฅผ pull ํ•˜๊ณ  ์‹ถ์„๋•Œ
  • conference-and-seminar
    • ๋ชจ๋˜ ํ”„๋ก ํŠธ์—”๋“œ ๊ฐœ๋ฐœํ™˜๊ฒฝ์˜ ์ดํ•ด
  • fire-base
    • Firebase .gitignore
  • vanillacoding
    • Data Structures
    • Sorting Algorithms - part 1
    • Promise
    • class
    • 04.quiz
    • 07.event-loop
    • Design Patterns
    • OOP (Object Oriented Programming)
  • etc
    • ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ฝ”๋“œ๋ฆฌ๋ทฐ
    • ์Šค์Šค๋กœ ๊ณต๋ถ€ํ•˜๋Š” ๋ฒ•
    • ๋ฐ”๋‹๋ผ์ฝ”๋”ฉ ์ˆ˜๊ฐ• ํ›„๊ธฐ
    • async ๊ณผ์ œ ํ›„๊ธฐ - ๋น„๋™๊ธฐ, ๋™๊ธฐ, ํด๋กœ์ €, ๋ฐฐ์—ด๊ณผ ๊ฐ์ฒด
    • ์œ ์šฉํ•œ ์‚ฌ์ดํŠธ
  • algorithm
    • The Supermarket Queue
    • Find the odd int
    • The Office III - Broken Photocopier
    • Directions Reduction
    • The Office II - Boredom Score
    • Divisible Sum Pairs
    • Codewars ์ด์šฉ์ž ์†”๋ฃจ์…˜ ๋ชจ์Œ
    • Shortest Word
    • find key
    • Two Sum
    • Simple Pig Latin
  • Book
    • the essence of object-orientation
      • ํƒ€์ž…๊ณผ ์ถ”์ƒํ™”
      • ๊ฐ์ฒด ์ง€๋„
      • ์ด์ƒํ•œ ๋‚˜๋ผ์˜ ๊ฐ์ฒด
      • ์ถ”์ƒํ™” ๊ธฐ๋ฒ•
      • 05. ์ฑ…์ž„๊ณผ ๋ฉ”์‹œ์ง€
      • 07.ํ•จ๊ป˜ ๋ชจ์œผ๊ธฐ
      • 04. ์—ญํ• , ์ฑ…์ž„, ํ˜‘๋ ฅ
      • ํ˜‘๋ ฅํ•˜๋Š” ๊ฐ์ฒด๋“ค์˜ ๊ณต๋™์ฒด
  • ecma-script2015
    • Object Literal Upgrades
    • default-parameter-template-literals-arrow-functions
    • spread-operator-rest-param
    • let-const-rest-parameter-spread-operator-destructuring
  • http
    • ์›น ๋ธŒ๋ผ์šฐ์ €์— URL์„ ์ž…๋ ฅํ–ˆ์„ ๋•Œ ์–ด๋–ป๊ฒŒ ์›น ํŽ˜์ด์ง€๊ฐ€ ๋ณด์—ฌ์งˆ๊นŒ?
  • jest
    • toThrow(error?)
  • data-structures
    • Data Structures
  • express
    • express generator
    • CORS
  • css-flexible-box-layout
    • flex ํ•ด๋ฒ„๋ ธ์ง€ ๋ญ์•ผ
  • git
    • Git
  • mongodb
    • MongoDB
  • markdown
    • use-markdown
  • cmder
    • cmd ๋ช…๋ น์–ด ๋ชจ์Œ
  • debug
    • trackClicksEx function error
  • npm
    • NPM TOKEN ์„ค์ •ํ•˜๊ธฐ
  • storybook
    • Storybook
  • sort
    • Sorting Algorithms - part 1
  • javascript-koans
    • Javascript Koans ์˜ค๋‹ต๋…ธํŠธ
  • rxjs
    • Rx.js
  • dom-elements
    • HTML Element
  • redux-toolkit
    • Redux Toolkit
  • github-actions
    • GitHub Actions
  • redux-middleware
    • redux middleware
  • rest
    • rest
  • css-rendering
    • ์ฝ”๋“œ ์Šคํ”ผ์ธ  - CSS Rendering 1ํšŒ์ฐจ 2/2
    • ์ฝ”๋“œ ์Šคํ”ผ์ธ  - CSS Rendering 1ํšŒ์ฐจ 1/2
  • you-dont-know-js
    • ํƒ€์ž…
  • server
    • # shutdown local server
  • semantic-versioning
    • Semantic Versioning 2.0.0
Powered by GitBook
On this page

Was this helpful?

  1. dom-elements

HTML Element

Previousdom-elementsNextredux-toolkit

Last updated 5 years ago

Was this helpful?

devdocs:

MDN:

์˜ˆ์‹œ ๋”ฐ๋ผํ•˜๊ธฐ: /

HTML Element ์ธํ„ฐํŽ˜์ด์Šค๋Š” ๋ชจ๋“  ์ข…๋ฅ˜์˜ HTML element๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค.(?) ์–ด๋–ค elements ์ง์ ‘์ ์œผ๋กœ ์ด ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ๋ฐ˜๋ฉด, ๋‹ค๋ฅธ element๋“ค์€ ๊ทธ๊ฒƒ์„ ์ƒ์†ํ•˜๋Š” ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ๊ตฌํ˜„ํ•œ๋‹ค.

Properties

๋ถ€๋ชจ์ธ Element์˜ ์†์„ฑ์„ ์ƒ์†ํ•œ๋‹ค. DocumentAndElementEventHandlers, ElementCssInlineStyle, GlobalEventHandlers, HTMLOrForeignElement, TouchEventHandlers์˜ ์†์„ฑ์„ ๊ตฌํ˜„ํ•œ๋‹ค.

  • HTMLElement.accessKey

    ์š”์†Œ์— ํ• ๋‹น๋œ accessKey๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” DOMString ์ด๋‹ค.

    accessKey๊ฐ€ ๋ญ”๊ฐ€ ํ–ˆ๋”๋‹ˆ ๋‹จ์ถ•ํ‚ค?

    accessKey: Mac์—์„œ๋Š” control + option + key๋ฅผ ํ–ˆ์„ ๋•Œ ์†์„ฑ์ด ๋จนํžŒ๋‹ค.

  • HTMLElement.accessKeyLabel (Read only)

    ์š”์†Œ์— ํ• ๋‹น๋œ accessKey๋ฅผ ํฌํ•จํ•˜๋Š” DOMString์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค. ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ๋นˆ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

    Syntax

    label = element.accessKeyLabel

    Example

    <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์ด ์ž๋™์™„์„ฑ์œผ๋กœ ์•ˆ๋œฌ๋‹ค.

  • HTMLElement.contentEditable

    ์ด๊ฒƒ์€ DOMString์ด๊ณ  element๋Š” ์ˆ˜์ •๊ฐ€๋Šฅ ํ•˜๋‹ค๋ฉด true, ๊ทธ๋ ‡์ง€์•Š๋‹ค๋ฉด false ๊ทผ๋ฐ DOMString inherit๋Š” ๋ถ€๋ชจ์˜ ์ˆ˜์ •๊ฐ€๋Šฅํ•œ ์ƒํƒœ๋ฅผ ์ƒ์†ํ•œ๋‹ค.

  • HTMLElement.isContentEditable

    ์š”์†Œ์˜ ์ˆ˜์ •์—ฌ๋ถ€๋ฅผ boolean์œผ๋กœ return ํ•ด์ค€๋‹ค. flag๋Š” ์ง„์งœ is๋กœ ์‹œ์ž‘..

    syntax

    editable = element.isContentEditable

    Example

    <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)

    (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.dataset

    return 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: 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 ๊ฐ€๋Šฅํ•˜๋‹ค. ์ •์˜๋œ language code๋ฅผ return ํ•œ๋‹ค. default value๋Š” unknown ์ด๋‹ค. Syntax

     let languageUsed = elementNodeReference.lang; // get 
     elmentNodeReference.lang = NewLangyage; // set

    Example

     document.documentElement.lang // get
  • HTMLElement.noModule module scripts๋ฅผ ์ง€์›ํ•˜๋Š” ์œ ์ € ์—์ด์ „ํŠธ์—์„œ importํ•œ script๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” Boolean์ด๋‹ค.

  • ์— ์‚ฌ์šฉํ•˜๋Š” ํ•œ๋ฒˆ๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์•”ํ˜ธํ™”๋œ ์ˆซ์ž๋ฅผ ๋ฆฌํ„ดํ•˜์—ฌ ์ฃผ์–ด์ง„ fetch์˜ ์ง„ํ–‰์„ ํ—ˆ์šฉํ• ์ง€ ๋ง์ง€ ์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•œ๋‹ค. script์—์„œ๋งŒ nonce ์†์„ฑ์ด ๋…ธ์ถœ๋œ๋‹ค. Examples

    let nonce = script['nonce'] || script.getAttribute('nonce');

    getAttribute์„ ์“ด๊ฑด ๊ณผ๊ฑฐ ๋ธŒ๋ผ์šฐ์ €๋“ค ์šฉ, script['nonce'] ์ตœ์‹  ๋ธŒ๋ผ์šฐ์ € ์šฉ์ด๋‹ค. ์ตœ๊ทผ ๋ถ€๋ผ์šฐ์ €์—์„œ accsessํ•˜๋Š” ๋ฐฉ๋ฒ•์€ script['nonce'] ์ด๋ ‡๊ฒŒ ๋ฐ–์— ์—†๋‹ค. nonce ๋ฐ์ดํ„ฐ๋ฅผ ์œ ์ถœํ•˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋œ๋‹ค. ๋” ์ฝ์„ ๊ฑฐ๋ฆฌ:

  • HTMLElement.spellcheck ์„ controlํ•˜๋Š” Boolean์ด๋‹ค.. ๋„ค? ์ด๋Ÿฐ๊ฒŒ ์žˆ์—ˆ๋‹ค๊ณ ์š”? ๐Ÿ™„

  • htmlelement.style ์ด๋‹ค. ์š”์†Œ์˜ ์ธ๋ผ์ธ ์Šคํƒ€์ผ์„ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋œ๋‹ค. 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()๋ฅผ ๋Œ€์‹  ์‚ฌ์šฉํ•˜๋ผ!

https://devdocs.io/dom/htmlelement
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
https://codesandbox.io/s/staging-feather-jthzn
https://jthzn.csb.app/
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey
https://codesandbox.io/s/staging-feather-jthzn
custom data attributes
drawing buffer
offscreen canvas
HTMLElement.inert
https://youtu.be/fGLp_gfMMGU
HTMLElement.innerText
HTMLElement.lang
Tags for Identifying Languages
HTMLElement.nonce
Content Security Policy
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_it
spell-checking
CSSStyleDeclaration