How to use performance.measure in firefox, - javascript

When I run this simple code in console :
performance.mark('start-mark');
performance.mark('stop-mark');
performance.measure('name','start-mark','stop-mark');
performance.measure returns PerformanceMeasure object (as in documentation https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure). The problem is that everything works fine in chrome, edge and safari. Unfortunately in firefox it reutrns undefined.
Beside documentation I checked also in caniuse.com and it should work.
Can you help me to run this "code" in firefox (version 93 - actual).

This appears to be a known implementation inconsistency in Firefox.
From https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure#browser_compatibility):
I worked around this using Performance.getEntriesByName:
performance.mark('start-mark');
performance.mark('stop-mark');
performance.measure('name', 'start-mark', 'stop-mark');
console.log(performance.getEntriesByName('name', 'measure')[0]);

Related

Focus preventScroll not working in firefox

I need to prevent the scroll caused by focus().
For this purpose, I found that if I use element.focus({preventScroll : true}) instead of element.focus(), it works fine, based on the documentation from mozilla.
However, this only works perfectly on Chrome but not in Firefox.
I'm wondering how could it be not supported by FireFox, when the documentation has been done by Mozilla.
Am I missing something here?
Focus method documentation by Mozilla

Is IE11 really not compatible with getNamedItem() JS function?

I'm trying to use getNamedItem() function. I can correctly access items using Chrome, Firefox, IE9 and IE10 ... but not when using IE11.
According to this, it seems expected : http://www.w3schools.com/jsref/met_namednodemap_getnameditem.asp
My question is : do we have an equivalent function which could be used in order to work with IE11 ?
getNamedItem() is supported in IE9+, including IE11.
Try this in IE11.

Cross browser issue with window.opener.insertHTML

This code works fine in Firefox window.opener.insertHTML but it doesnot work for IE. I just noticed that this code works even for IE9 but its not working for IE8
How can i get it to work for both the browsers?
The insertHTML command is for documents in design mode. It is a Mozilla invention and apparently isn't supported by IE.
Please try with pasteHTML insted of InsertHtml.

Can't get MozTransform to work with Javascript

I'm trying to get the zoom function for Firefox to work using javascript but no luck, what am I doing wrong?
function zoomIn() {
document.getElementById('increaseWrapper').style['MozTransform'] = 'scale(1.5)';
}
Thanks in advance.
Your code seems to work perfectly find in this jsFiddle in Firefox 6.
Remember, 'MozTransform' only applies to Mozilla derived browsers. Safari and Opera and others have their own name for that attribute until it becomes an endorsed standard.
If you're trying your code in mozilla 4+ browser, then there must be something else wrong with your code because what you have disclosed in your question works fine in the right browser with the right HTML.
Have you checked your browser's error console or debugger console to see if you're experiencing an javascript errors that might be keeping your code from executing?

Javascript does not work in Opera - strange

have a javascript code to exec on a page - all works fine in Firefox, IE, Chrome but does not work in Opera 10+.
Strange is that this javascript works fine in previous versions of Opera (9.xx is fine) and even more strange is that when I lunch Dragonfly on Opera 10+ the javascript works also fine (and Dragonfly does not throw any errors).
Have anyone experienced this behavior and found any solution/workaround?
As the js code is quite complicated, huge and part of it dynamically generated I am not posting any sample of it - my question is just about the behavior and if someone has any experiencies with debuging/resolving.
Thanks,
Jan
It sounds like a bug in Opera's Just In Time (JIT) compilation. I assume that it worked in 10.10 but broke in 10.50 and above. Does it work if you disable this option: opera:config#jit ?
I would very much appreciate a bug report with code - https://bugs.opera.com/wizard/ . If you report the bug number here I can follow up a little bit faster :).
Check this Tools..Preferences..Advanced..Content..Javascript options
Or tools..Quick preferences..ensure "enable Javascript checked"
Or you have overridden these with site preferences or user mode stuff.
I'm typing this in Opera 10.60 with no problems, admittedly not as developer or with Dragonfly running
Try: Tools -> Advanced -> Error Console

Categories