Javascript Launch in IE - What does “JScript window script block” mean?

Javascript runs very slowly on IE on some pages of our site.

Profiling seems to show that the following methods take the most time:

Method count inclusive time exclusive time) JScript - window script block 2,332 237.98 184.98 getDimensions 4 33 33 eh 213 32 32 extend 446 30 30 tt_HideSrcTagsRecurs 1,362 26 26 String.split 794 18 18 $ 717 49 17 findElements 104 184.98 14 

What does the "JScript window script block" do?

We use jquery and prototype.

+4
source share
5 answers

In my experience, the main problems of the prototype are the following:

$$ selector

Try using $ selector with down or select .

notes

Do not use for many observations. If you want the click handler for multiple elements to use identifiers and a global document, follow these steps:

 document.observe('click', this.clickHandler.bindAsEventListener(this)); clickHandler: function(e) { var elt = e.element(); while (Object.isElement(elt)) { switch (elt.id) { //do your stuff here } elt = elt.up(); //Bubbling } } 

CSS selectors with unsupported features in IE

This code will work, but performance will decrease.

 <input type="checkbox"/> //HTML $$('[type=checkbox]') //Prototype 

Using a class name will improve performance in this situation:

 <input class="checkbox" type="checkbox"/> //HTML $$('.checkbox') //Prototype 

Search in the DOM tree

All that requires a search for the DOM tree.

+3
source

I know this question is old, but for those who get to it from the search results.

I am sure that the "JScript-window script block" is an IE developer proxy server for javascript that runs in a global scope or anonymous function.

+2
source

If I remember the script window correctly, the block has something to do with IE Internet security settings, blocking script execution. "Have you noticed the yellow bar?" and such questions should appear on the page.

It all depends on the settings of your security zone in IE, I think.

http://www.questiontools.com/faq_scriptwarning.html

+1
source

WebSit SunSpider test (which covers a wide selection of pure JavaScript functionality). Here is a break down:

JavaScript Performance Rundown
(source: ejohn.org )

as you can see, IE runs slowly on javascript.

Source and much more here .

+1
source

There is no right answer, because there is no sample code in what it does.

However, the first thing you need to pay attention to is the DOM manipulation in loops. Whenever you touch the DOM in loops, this is usually a bad idea for performance, as manipulating the DOM is obviously slow.

Using JavaScript, you can significantly reduce DOM manipulation in loops by doing something like this (using jQuery in this example):

 // make a container for your DOM additions var $div = $('<div>'), i, list = ['a','b','c','d'], for (i = 0; i < list.length; i++) { $div.append( $('<span>').text(list[i]) ); } // now you can append to the DOM once instead of in a loop $('body').append($div); 

This, of course, is not necessarily related to loops. It can be any DOM manipulation called over and over, for example, window.resize or scrolling or moving the mouse or keyboard, etc. Etc. Inspect what your code does and identify the slowest parts. Start there.

+1
source

Source: https://habr.com/ru/post/1309625/


All Articles