JavaScript and CSS changes in IE Mobile for Windows Phone 7

For IE Mobile in Windows Phone 7, we've made a couple of JavaScript and CSS enhancements that you can try out today in the Windows Phone 7 Emulator.

The new scripting functions are:

  • getElementsByClassName(name): given the class specified by name, returns all of the elements or sub-elements within the scope of this function call
  • querySelector(selector): given the selector, returns the first element within the sub-tree of the scope of this function call that matches the selector
  • querySelectorAll(selector): given the selector, returns allĀ elements within the sub-tree of the scope of this function call that match the selector

We've also added support for the -webkit-text-size-adjust CSS selector. This selector allows you to control how text on the Web page is scaled to increase readability for the user (you can also useĀ  -ms-text-size-adjust, IE Mobile recognizes both).

You can set the value of the selector to "none", "auto", or a percentage value.

  • "none": turns off text size adjustment. For example, html { -ms-text-size-adjust:none } turns off text adjustment for the entire page.
  • "auto": sets the text size adjustment to the automatic setting
  • percentage: use the specified percentage value to adjust text size. For example, .title { -ms-text-size-adjust: 150% } will adjust the text size for elements that are assigned the "title" CSS class.

[Update 05/11/2010: based on community feedback, we will only be implementing the -ms- prefix, not the -webkit- one.]

Joe Marini
Principal Program Manager
Windows Phone