Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The undetectables

As we’ve already alluded to, there are definitely nuances in writing a polyfill for one technology to the next. However, there are also the black holes, those undetectable technologies.

A simple example of an “undetectable” is a technology that gives a false positive when tested.

Let’s take, for example, the contenteditable attribute from Chapter 2. If you test for the attribute using the methods we’ve seen so far, it will tell you that contenteditable is supported, but really the problem is that on a device like Safari Mobile (pre-iOS 5) the keyboard doesn’t actually focus to the editable area, so in reality it’s not supported, regardless of the feature detection test.

It’s hard to say exactly what is and isn’t available to feature test. So long as you’re testing your polyfill against all the browsers your site plans to support, you’ll find whether or not the feature can be truly and reliably detected.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint