Comments (8)
Our HTML parser is the browser's parser. Does it act differently, for example throw an exception, when you do not use jQuery and instead use direct DOM operations?
from jquery.
I'm not familiar with the direct DOM operations, what would be equivalent? Using document.getElementById("someid").innerHTML = htmlString
, it does not act differently in Firefox, Chromium, Safari, or Opera; see http://jsbin.com/hobuze/edit?html,console,output
If this is a browser bug, why is it the same in multiple browsers?
from jquery.
Yes, that is the equivalent operation, and the two behave similarly. No browser attempts to give an error, they just try to make sense of what you have given them. which may involve ignoring some of the input. See this article.
from jquery.
I understand dropping some of the input, but preventing developers from seeing the problem is an impediment to debugging. If the browsers fix the bug in their innerHTML= implementations, will that also generate the warning on .html()?
https://bugzilla.mozilla.org/show_bug.cgi?id=1085368
https://code.google.com/p/chromium/issues/detail?id=425101
https://bugs.webkit.org/show_bug.cgi?id=137881
from jquery.
Per the article, HTML5 parsing is lenient by design. A browser can give something like a console warning, but jQuery doesn't get involved in that process--you would need to look at the console.. IE10 and IE11 already do this for many static HTML errors on page, but don't give errors on HTML injection via .innerHTML
.
from jquery.
A console warning is exactly what I think is missing.
from jquery.
@Polyergic I don't think it's jQuery's job to provide console warnings for such things; browsers would have it easy to implement them today and they're not doing it on purpose; otherwise devs would get flooded with warnings.
jQuery's .html()
setter internally sets the value of innerHTML
so if a browser generates the warning, using jQuery will do it too. If we claimed we know better than browser vendors and there should be warnings about that, if a browser implements its own warnings you'd get a duplicate.
We're doing a right thing by not logging anything here by ourselves.
from jquery.
... which is why I submitted bugs to the browsers...
from jquery.
Related Issues (20)
- Feature Requests: Please read https://github.com/jquery/jquery/wiki/Adding-new-features Most features should start as pl
- Uncaught TypeError: Cannot read properties of undefined (reading 'createElement') HOT 1
- Event triggering is being captured incorrectly HOT 5
- CSP problem HOT 8
- AJAX with zero form fields does not send `Content-Type` header HOT 1
- manual triggering of pointer event
- jquery destructuring assignment HOT 3
- 网络安全漏洞修复 HOT 1
- Prepare a 4.0 blog post & an upgrade guide HOT 2
- Jquery upgrade from 3.6.0 to 3.7.1
- Cross Site Scripting (DOM) issue
- Treeveiw not woking with jquery 3.7.1 HOT 10
- DOM based Cross-Site Scripting (XSS) HOT 1
- Uncaught TypeError: Cannot read properties of undefined (reading 'createDocumentFragment') in jQuery 3.7.1 HOT 1
- Content-Security-Policy / nonce error in DOMEval HOT 2
- Facing jQuery Selector issue after upgrading from 1.7.1 to 3.7.1 HOT 1
- Jquery 4.0 beta? HOT 1
- jQuery .load function errors if loading html with auto-removing script tag HOT 2
- Strange error behavior of event delegation when customizing jQuery HOT 3
- invalid assignment left-hand side in jquery-3.7.1.min.js HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery.