Title: isXMLDoc() - Uncaught TypeError: Cannot read property 'namespaceURI' of undefined · Issue #4782 · jquery/jquery · GitHub
Open Graph Title: isXMLDoc() - Uncaught TypeError: Cannot read property 'namespaceURI' of undefined · Issue #4782 · jquery/jquery
X Title: isXMLDoc() - Uncaught TypeError: Cannot read property 'namespaceURI' of undefined · Issue #4782 · jquery/jquery
Description: Description isXMLDoc() throws an error if undefined given, starting from version 3.4.0 Test script: jQuery.isXMLDoc(undefined) jQuery 3.3.1 result: false jQuery 3.5.1 (currently the latest, but starting from 3.4.0) result: Uncaught TypeE...
Open Graph Description: Description isXMLDoc() throws an error if undefined given, starting from version 3.4.0 Test script: jQuery.isXMLDoc(undefined) jQuery 3.3.1 result: false jQuery 3.5.1 (currently the latest, but sta...
X Description: Description isXMLDoc() throws an error if undefined given, starting from version 3.4.0 Test script: jQuery.isXMLDoc(undefined) jQuery 3.3.1 result: false jQuery 3.5.1 (currently the latest, but sta...
Opengraph URL: https://github.com/jquery/jquery/issues/4782
X: @github
Domain: redirect.github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"isXMLDoc() - Uncaught TypeError: Cannot read property 'namespaceURI' of undefined","articleBody":"\u003c!--\r\nFeature Requests:\r\n Please read https://github.com/jquery/jquery/wiki/Adding-new-features\r\n Most features should start as plugins outside of jQuery.\r\n\r\nBug Reports:\r\n Note that we only can fix bugs in the latest version of jQuery.\r\n Briefly describe the issue you've encountered\r\n * What do you expect to happen?\r\n * What actually happens?\r\n * Which browsers are affected?\r\n Provide a *minimal* test case, see https://webkit.org/test-case-reduction/\r\n Use the latest shipping version of jQuery in your test case!\r\n We prefer test cases on JS Bin (https://jsbin.com/qawicop/edit?html,css,js,output) or CodePen (https://codepen.io/mgol/pen/wNWJbZ)\r\n\r\nFrequently Reported Issues:\r\n * Self-closing tags broken in jQuery 3.5.0 or newer: please read the [jQuery 3.5.0 blog post](https://blog.jquery.com/2020/04/10/jquery-3-5-0-released/) \u0026 the [upgrade guide](https://jquery.com/upgrade-guide/3.5/); see also issue #4681.\r\n--\u003e\r\n\r\n### Description ###\r\n\r\n`isXMLDoc()` throws an error if `undefined` given, starting from version 3.4.0\r\n\r\n#### Test script:\r\n`jQuery.isXMLDoc(undefined)`\r\n\r\n#### jQuery 3.3.1 result:\r\n`false`\r\n\r\n#### jQuery 3.5.1 (currently the latest, but starting from 3.4.0) result:\r\n`Uncaught TypeError: Cannot read property 'namespaceURI' of undefined`\r\n\r\n#### Techinfo\r\n\r\nBefore the **Sizzle** update from 2.3.3 to 2.3.4 (see related commit below), `isXML()` function looked liked this:\r\n```\r\nisXML = Sizzle.isXML = function( elem ) {\r\n\t// documentElement is verified for cases where it doesn't yet exist\r\n\t// (such as loading iframes in IE - #4833)\r\n\tvar documentElement = elem \u0026\u0026 (elem.ownerDocument || elem).documentElement;\r\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\r\n};\r\n```\r\n\r\nThis **doesn't throw an error**, when the `elem` is `undefined`, because it checks it.\r\n\r\nIn the update from 3.4.0, it looks like this:\r\n```\r\nisXML = Sizzle.isXML = function( elem ) {\r\n\tvar namespace = elem.namespaceURI,\r\n\t\tdocElem = ( elem.ownerDocument || elem ).documentElement;\r\n\r\n\t// Support: IE \u003c=8\r\n\t// Assume HTML when documentElement doesn't yet exist, such as inside loading iframes\r\n\t// https://bugs.jquery.com/ticket/4833\r\n\treturn !rhtml.test( namespace || docElem \u0026\u0026 docElem.nodeName || \"HTML\" );\r\n};\r\n```\r\n\r\nThis **throws an error** when the `elem` is `undefined`:\r\n`Uncaught TypeError: Cannot read property 'namespaceURI' of undefined`\r\n\r\n**Please, if you can, bring back the previous functionality: `undefined` is not an XML node, so it should return a false boolean instead of a TypeError.**\r\n\r\nThanks in advance!\r\n\r\n### Additional info ###\r\n\r\nRelated commit: https://github.com/jquery/jquery/commit/d940bc063cd5ae09bf52067bbe046fda88f1f687 (from line 562)\r\nRelated blog-post: https://blog.jquery.com/2019/04/10/jquery-3-4-0-released/","author":{"url":"https://github.com/borzaka","@type":"Person","name":"borzaka"},"datePublished":"2020-08-29T12:20:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/4782/jquery/issues/4782"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:db88a405-3b9f-0717-1dc5-37069873cc62 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A6E:3AEBEF:17821CC:2044B81:6A652614 |
| html-safe-nonce | a395316feda61ffea958e81a34180e12a7d3a52b7cc8c87928d2415686e28697 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTZFOjNBRUJFRjoxNzgyMUNDOjIwNDRCODE6NkE2NTI2MTQiLCJ2aXNpdG9yX2lkIjoiNjI1MTM0ODAxNjYyNzAwMDg1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 38122ff3e9dc44cd2976d8703a59f6ed321c1e4ae982ed16ef97f829e04d9cf7 |
| hovercard-subject-tag | issue:688523299 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/jquery/jquery/4782/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f8dfccc0fa1dcfe3cbcdb5b293dc145ecacc9f7820e066297d0eb1622178dc4/jquery/jquery/issues/4782 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f8dfccc0fa1dcfe3cbcdb5b293dc145ecacc9f7820e066297d0eb1622178dc4/jquery/jquery/issues/4782 |
| og:image:alt | Description isXMLDoc() throws an error if undefined given, starting from version 3.4.0 Test script: jQuery.isXMLDoc(undefined) jQuery 3.3.1 result: false jQuery 3.5.1 (currently the latest, but sta... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | borzaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 52c76df668885aaff23b50bdca1fa1ea44ac9c1553e888ebc70ff1e4daa4625b |
| turbo-cache-control | no-preview |
| go-import | github.com/jquery/jquery git https://github.com/jquery/jquery.git |
| octolytics-dimension-user_id | 70142 |
| octolytics-dimension-user_login | jquery |
| octolytics-dimension-repository_id | 167174 |
| octolytics-dimension-repository_nwo | jquery/jquery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 167174 |
| octolytics-dimension-repository_network_root_nwo | jquery/jquery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 309153364422b3c499922d1a2a6404910a58ed8e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width