Why does cancelBubble work in Google Chrome? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am confused I thought that cancelBubble is IE-only Boolean property but found it in Chrome.

From early on, the Chrome folks took the approach of trying to be broadly compatible with existing code, which in some cases meant being compatible with code written using IE-only features. Another example of this is the global event variable, an IE-specific variable set to the current event during event callbacks (so callbacks use the global rather than an argument as they do with addEventListener). Chrome has supported that since the beginning for IE-specific code that relied on it; Firefox has only recently started supporting the global event variable. Supporting cancelBubble is in that same category.
They don't support every IE-specific thing (for instance, not attachEvent), so as to avoid messing with code trying to detect IE event handling and branch. But they support a lot of IE-isms.

Related

Is there any way to run old versions of JavaScript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I was wondering if there was any way for me to run older versions of javascript in the web browser!
I have apps that require ECMAScript 3 that broke and I was wondering if there was anyway to run older versions without a polyfill library!
While it works fine, I want it to use ECMAScript 3 for functions like goto and such
JavaScript does not have, and has never had, goto.
and I dislike using the newer keywords.
Whatever you mean by "newer keywords", if you dislike using them, then don't use them.
Does anyone know of a way to use older ECMAScript/JavaScript versions?
Yes, use any current ES/JS version, since they are all completely backward compatible for all practical purposes.
Take a look at Babel, it's a traspiler of Js to Js, you can set the enter version and the out version and it's easy to setup.

Why Google Chrome warns that a function could not be optimized because of a ForIn loop? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have an enterprise javascript web application where I utilize the for-in loop a lot. When I profiled the application at a potential bottleneck, Chrome profiler gave me lots of exclamation mark icons next to function names, and alerted that those functions were not optimized due to ForIn loop.
The profiled code had many functions using for-in loop, also in recursion.
I couldn't find any related material on the internet about this. Why these loops affect performance? How to work it around? Can it really be a bottleneck?
You can learn more about optimization of For-In loops, at the following link
Optimization killers in Node.js
It is the same case for google chrome javascript, Node.js and Chrome implements V8 Javascript engine
If you are using loop like
for(var prop in myobj){
}
The reason chrome assumes it becuase, the for in loop will loop all the methods internal native properties and some of the property which is in accessible similar we see in the google chrome console
that could be the reason

Is it safe to use JavaScript with IE? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Everytime I think about using JavaScript (or any JS library) I see this red light in front of me. My only concern as usual is IE. So here is what I want to know:
1) Is JavaScript disabled by default in IE8 or IE9?
2) What about you, do you feel safe when including a JavaScript code in a site that may be viewed using IE 8 or 9?
3) I found so many problems when applying CSS rules to html5 tags in IE8 so I used Modernizr. However it depends on JavaScript to enable html5 tags so I could apply CSS rules to them in IE. Am I risking to lose CSS styling as well, by using Modernizr?
No JavaScript is not disabled by default in IE8/IE9
Yes I feel safe, because I code defensively with those browsers in mind if they're mentioned as requirements in the project spec.
Again, code for your requirements. If you have a real reason to believe that modernizr isn't going to cover your requirements, don't use it and style accordingly.
1) No, it is enabled by default
2) Safety is not a concern for you in that case. Nowadays, modern Javscript libraries even support IE quite well. They often implement workarounds for features not supported by IE, so that users just can't use all features the libraries has, but the scripts shouldn't crash any more.
That said, you still need to test your sites in IE.
Javascript has become a widely accepted standard finally.

Javascript : What are the different conditions when javascript work in IE but not in Firefox or some other browser? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Javascript : What are the different conditions when javascript work in IE but not in Firefox or some other browser?
one that i know of is that while using certain window events..
What other scenarios can cause javascript to not work properly?
The answer is too complex to fully list here. Use sites like http://caniuse.com that will tell you which JavaScript is available in which browser.
Generally speaking, all browsers implement JavaScript differently. Microsoft have long been stuck in their own world, implementing their own ways to do things, whereas everyone else seems to try and conform to the standards as much as possible. Microsoft are coming around to the "standards" way of doing things, and from what I hear, IE11 will be a massive step in this direction.
As already mentioned, you can use http://caniuse.com/ to find what you can and can't do in different browsers, but then you'll likely end up doing what many others have done...write your own API which works around these to achieve a task...which is a bit unnecessary, unless you can find a ground-breaking way to implement your API that will be beneficial to other developers.
APIs like jQuery already work around these differences. The aim with these libraries is to provide clean JavaScript, whilst being completely transparent from the underlying JavaScript implementation.
Also, look into "shim"/"polyfill" implementations. These are used when a core feature that is recognised as part of an ECMAScript version has not been implemented in the browser. These provide the implementation for you, if it is not natively supported.

Mozilla's JavaScript issues [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm preparing a presentation about JavaScript in different browsers.
I know that there are several issues with Mozilla. For example the constructor of the Date object will not accept the ISO date string. It will result in invalid date.
I've been looking for a errata which lists all known issues of this browser in one place. But I couldn't find such.
Q: Does anyone know some link or document that lists the issues of this browser. At least the most significant ones?
Thanks in advance.
What you seem to want is bug 445494 - a tracking bug for all known ECMAScript 5 compliance issues. Look at the open bugs that it depends on. There are apparently two strict mode issues left (disabling document.all in strict mode and throwing an exception if a variable is accessed too early), String.match and String.replace methods don't update RegExp.lastIndex property, some non-standard special treatment for the Array.length property and a few similarly small issues.

Categories

Resources