clever98 / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

IE11 fails on getComputedTextLength if Blockly not visible #248

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a blockly in an hidden IFRAME make sure it loads up existing blocks 

What is the expected output? What do you see instead?
It should render in the background - the error of "Unexpected call to method or 
property access." in Blockly.Field.prototype.render_

It is this.textElement_.getComputedTextLength() even though the textElement 
exists and is a text svg elem.

What browser are you using?
IE11

Please provide any additional information below.

I found that I had to replace with

Blockly.Field.prototype.render_=function(){
    var a;
    try{
         a=this.textElement_.getComputedTextLength();

    }catch(e){
        a=this.textElement_.childNodes[0].length*8;
    }
    this.borderRect_&&this.borderRect_.setAttribute("width",a+Blockly.BlockSvg.SEP_SPACE_X);
    this.size_.width=a
};

When Blockly is visible the "a=this.textElement_.getComputedTextLength();" 
works perfectly. This issue is in IE only.

Original issue reported on code.google.com by primary....@gmail.com on 1 Sep 2014 at 11:54

GoogleCodeExporter commented 8 years ago
Fixed in r1770.  Thanks!

Original comment by neil.fra...@gmail.com on 8 Sep 2014 at 5:59