Ticket #7866 (closed enhancement: wontfix)
Conditional compilation with #if #else
|Reported by:||Aziz||Owned by:|
There are a growing number of special hacks for various browsers inside jQuery. I estimate that most of the hacks are there to circumvent issues in the highly esteemed browser made by Microsoft.
Can we please get a mechanism or a way that allows us to exclude code that's completely unnecessary? Because I'm certain I'm not the only one who doesn't want to support IE in his (hobby) projects. That might not be an option to most developers, but it's reasonable to think that they at least would want to choose to disregard older versions of a browser (like IE6.)
Here's an example of what I'm talking about:
// Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data );
The same with an if-directive:
// Make sure leading/trailing whitespace is removed (IE can't handle it) //#if IE data = jQuery.trim( data ); //#endif
Directives like these would clearly mark all the hacks and thereby improve the documentation. The normal comments already mention it when browsers need special handling, so why not do it in the form of directives to allow for customization? What's the harm?