概述
Node.innerText
是一個代表節點及其後代之「已渲染」(rendered)文字內容的屬性。如同一個存取器,Node.innerText
近似於使用者利用游標選取成高亮後複製至剪貼簿之元素的內容。此功能最初由 Internet Explorer 提供,並在被所有主要瀏覽器採納之後,於 2016 年正式成為 HTML 標準。
Node.textContent
屬性是一個相似的選擇,但兩者之間仍有非常不同的差異。
規範
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'innerText' in that specification. |
Living Standard | Introduced, based on the draft of the innerText specification. See whatwg/html#465 and whatwg/compat#5 for history. |
瀏覽器相容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 4 | 45 (45) | 6 | 9.6 (probably earlier) | 3 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 2.3 (probably earlier) | 45.0 (45) | 10 (probably earlier) | 12 | 4.1 (probably earlier) |