aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2023-06-12 22:12:15 +0100
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-06-12 23:12:33 +0200
commita75d6b52fad212820358e8ada3154f2f634e699b (patch)
treec5c637b518290f539ba96ba0cb4752cf0a37a776 /src
parent338de3599039a3ba906214e656bcbe637430c37d (diff)
downloadjquery-a75d6b52fad212820358e8ada3154f2f634e699b.tar.gz
jquery-a75d6b52fad212820358e8ada3154f2f634e699b.zip
Core: Fix regression in jQuery.text() on HTMLDocument objects
Fixes gh-5264 Closes gh-5265 (cherry picked from commit 44c56f87a31fbc1f43ac575cfd06a0df12073352)
Diffstat (limited to 'src')
-rw-r--r--src/core.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core.js b/src/core.js
index 16cd9a7c7..8ed56b7e8 100644
--- a/src/core.js
+++ b/src/core.js
@@ -271,9 +271,14 @@ jQuery.extend( {
// Do not traverse comment nodes
ret += jQuery.text( node );
}
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ }
+ if ( nodeType === 1 || nodeType === 11 ) {
return elem.textContent;
- } else if ( nodeType === 3 || nodeType === 4 ) {
+ }
+ if ( nodeType === 9 ) {
+ return elem.documentElement.textContent;
+ }
+ if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}