-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature-detect for Document Fragments #641
Conversation
Nice! reading https://github.com/Modernizr/Modernizr/wiki/How-We-Test ... your tests are probably too exhaustive.. just checking |
Oh, you're probably right about simplifying the tests. Whilst researching this feature, I came across notes that IE6 does not create a Fragment, but rather creates a new Document object. Much of my code is there to confirm that whatever is returned actually behaves the way it needs to. Even though IE6 was a little strange, it does complete the test. I just wasn't sure if we'd be this lucky with every barely-conforming browser, but I'm happy to reduce this to a simple presence check if you like. |
Ah. Sounds like a bug in IE6 that we'd want to discover and then discard |
IE6's implementation does function as expected. Hmm, just took a look at http://www.quirksmode.org/m/w3c_core.html#t112 I don't think we need to check some of the other quirks IE 6 and 7 (http://reference.sitepoint.com/javascript/DocumentFragment) as that falls outside the "90% use case", or outside of mine, anyhow. :P Checking if Fragments have the "normalize" methods smells like unnecessary conformance testing to me. So, do I make this more expensive to cover a known broken implementation? Or do I slim it down even more and trust that most people will never use the broken part? |
I would say; slim it down! @paulirish what do you think? |
@paulirish @sindresorhus I've slimmed this down to just detecting that the methods required to use Document Fragments have been defined. Further, I've updated this for compatibility with Modernizr 3. Please let me know if there are any further outstanding issues. <3 |
nice! thanks for the update! On Tue, Apr 2, 2013 at 10:35 PM, Ron Waldon notifications@github.comwrote:
|
@jokeyrhyme it would be great ot get this merged in - could you squash all of the commits down into a single one? |
@patrickkettner done! |
tiny nit, then 👍 |
reports true as expected in IE 6-10, Chrome, Opera
@patrickkettner done! |
LGTM, cheers Ron :-) |
feature-detect for Document Fragments
feature-detect for Document Fragments
reports true as expected in IE 6-10, Chrome, Opera, probably in Firefox
reports false on a few old Nokia handsets in the office, probably on old Blackberries too
As using Document Fragments is considered a performance and stability best-practice for DOM manipulation, I think it's worth knowing when you can actually use this technique safely.
I have probably been a little too pedantic, so do let me know if some of the tests ought to be trimmed.