Baseline Widely available *
Node
ì¸í°íì´ì¤ì textContent
ìì±ì ë
¸ëì ê·¸ ììì í
ì¤í¸ ì½í
ì¸ ë¥¼ ííí©ëë¤.
êµ¬ë¬¸ì°¸ê³ :
textContent
ìHTMLElement.innerText
ê° ì주 í¼ëë곤 íì§ë§, ë ìì±ìë ëª ê°ì§ ì¤ìí ì°¨ì´ì ì´ ììµëë¤.
let text = someNode.textContent;
someOtherNode.textContent = string;
ê°
문ìì´ ëë null
.
textContent
ì ê°ì ìí©ì ë°ë¼ ë¤ë¦
ëë¤.
ë
¸ëê° document
ëë Doctypeì´ë©´ null
ì ë°íí©ëë¤.
ì°¸ê³ : ì ì²´ 문ìì 모ë í
ì¤í¸ì CDATA ë°ì´í°ë¥¼ ì»ì¼ë ¤ë©´ document.documentElement.textContent
를 ì¬ì©íì¸ì.
ë
¸ëê° CDATA 구í, 주ì, ì²ë¦¬ ëª
ë ¹, í
ì¤í¸ ë
¸ëë©´ ë
¸ë ë´ì í
ì¤í¸, ì¦ Node.nodeValue
를 ë°íí©ëë¤.
ë¤ë¥¸ ë
¸ë ì íì ëí´ìë 주ìê³¼ ì²ë¦¬ ëª
ë ¹ì ì ì¸í 모ë ìì ë
¸ëì textContent
를 ë³í©í 결과를 ë°íí©ëë¤. ììì´ ìë ê²½ì° ë¹ ë¬¸ìì´ì
ëë¤.
ë
¸ëì textContent
를 ì¤ì íë©´, ë
¸ëì 모ë ììì 주ì´ì§ 문ìì´ë¡ ì´ë£¨ì´ì§ íëì í
ì¤í¸ ë
¸ëë¡ ëì¹í©ëë¤.
innerText
ìì ì°¨ì´ì
ë¹ë¡ Node.textContent
ì HTMLElement.innerText
ì ì´ë¦ì´ ì ì¬í긴 íì§ë§, ì¤ìí ì°¨ì´ê° ìì¼ë¯ë¡ í·ê°ë¦¬ì§ ë§ì¸ì.
textContent
ë <script>
ì <style>
ìì를 í¬í¨í 모ë ììì ì½í
ì¸ ë¥¼ ê°ì ¸ìµëë¤. ë°ë©´ innerText
ë "ì¬ëì´ ì½ì ì ìë" ììë§ ì²ë¦¬í©ëë¤.
textContent
ë ë
¸ëì 모ë ìì를 ë°íí©ëë¤. ê·¸ì ë¹í´ innerText
ë ì¤íì¼ë§ì ê³ ë ¤íë©°, "ì¨ê²¨ì§" ììì í
ì¤í¸ë ë°ííì§ ììµëë¤.
innerText
ì CSS ê³ ë ¤ë¡ ì¸í´, innerText ê°ì ì½ì¼ë©´ ìµì ê³ì°ê°ì ë°ìí기 ìí´ ë¦¬íë¡ì°ê° ë°ìí©ëë¤. (리íë¡ì° ê³ì°ì ë¹ì¸ë¯ë¡ ê°ë¥íë©´ í¼í´ì¼ í©ëë¤)Internet Explorer 기ì¤, innerText
를 ìì íë©´ ììì 모ë ìì ë
¸ë를 ì ê±°íê³ , 모ë ìì í
ì¤í¸ ë
¸ë를 ì구í íê´´í©ëë¤. ì´ë¡ ì¸í´, í´ë¹ í
ì¤í¸ ë
¸ë를 ì´íì ë¤ë¥¸ ë
¸ëë ë¬¼ë¡ ê°ì ë
¸ëì ì½ì
íë ê²ë ë¶ê°ë¥í©ëë¤.
innerHTML
ê³¼ì ì°¨ì´ì
Element.innerHTML
ë ì´ë¦ ê·¸ëë¡ HTMLì ë°íí©ëë¤. ê°í¹ innerHTMLì ì¬ì©í´ ììì í
ì¤í¸ë¥¼ ê°ì ¸ì¤ê±°ë ì°ë ê²½ì°ê° ìì§ë§, HTMLë¡ ë¶ìí íìê° ìë¤ë ì ìì textContent
ì ì±ë¥ì´ ë ì¢ìµëë¤.
ì´ì ëí´, textContent
ë XSS 공격ì ìíì´ ììµëë¤.
ë¤ìê³¼ ê°ì HTML ì¡°ê°ìì...
<div id="divA">This is <span>some</span> text!</div>
textContent
를 ì¬ì©í´ ììì í
ì¤í¸ ì½í
ì¸ ë¥¼ ê°ì ¸ì¤ê±°ë...
let text = document.getElementById("divA").textContent;
// The text variable is now: 'This is some text!'
í ì¤í¸ ë´ì©ì ì¤ì í ì ììµëë¤.
document.getElementById("divA").textContent = "This text is different!";
// The HTML for divA is now:
// <div id="divA">This text is different!</div>
ë¸ë¼ì°ì í¸íì± ëª
ì¸ ì°¸ê³
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4