javascript - Why does .css('fontSize') produce different results in Edge? -


consider code (also in a fiddle):

document.getelementbyid("span").innerhtml += $('#input').css('fontsize');
span input {    font-size: inherit;  }    input {    font-size: 15px;  }
<span id="span" style="font-size: 30px;">    <input id="input"/>  </span>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

in chrome , firefox, .css('fontsize') return 30px, in edge , ie it's 15px. why that? dom explorer in edge shows 15px in strikethrough, , therefore should take inherited 30px fontsize:

and input rendered 30px font, ie/edge picking rendering purposes.

update: bug below fixed; fremycompany says he/she program manager edge team , fix reach customers in 2017.


it looks ie , edge bug. not having found it, i reported it.

here's update snippet sees ie/edge telling jquery via getcomputedstyle or currentstyle:

var input = $("#input");  console.log("jquery: " + input.css('fontsize'));  if (window.getcomputedstyle) {    console.log("getcomputedstyle: " + getcomputedstyle(input[0]).fontsize);  }  if (input[0].currentstyle) {    console.log("currentstyle: " + input[0].currentstyle.fontsize);  }
span input {    font-size: inherit;  }    input {    font-size: 15px;  }
<span id="span" style="font-size: 30px;">    <input id="input"/>    <span id="size"></span>  </span>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

for me, ie11 returns 15px both getcomputedstyle , microsoft-specific currentstyle property (it's reassuring @ least same thing):

enter image description here

so it's not jquery bug, it's microsoft bug when reporting size via javascript (looks when inherit governing rule), though it's rendering correctly.

i tried find way make grey area, couldn't think of anything. instance, according spec, having input inside span entirely valid.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -