Skip to content

Commit

Permalink
Updated build system
Browse files Browse the repository at this point in the history
Added ie6css module - UNTESTED
  • Loading branch information
jollytoad committed May 15, 2009
1 parent 085116a commit b3f4ef8
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ MODULES = \
mutations.html.js\
mutations.val.js

OPTIONAL_MODULES = \
mutations.ie6css.js

include build/rules.mk

2 changes: 1 addition & 1 deletion build
Submodule build updated 1 files
+2 −6 rules.mk
71 changes: 71 additions & 0 deletions src/mutations.ie6css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* jQuery IE6-CSS @VERSION (@DATE)
*
* Copyright (c) 2009 Adaptavist.com
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*/
/* Add/remove css class names to elements to represent the current attributes,
* for backwards compatibility with backwards browsers - you know who you are!
*
* I'd recommend including this, and the supporting CSS file in a conditional comment:
*
* <!--[if lt IE 6]>
* <script type="text/javascript" src="ie6css.js"/>
* <![endif]-->
*
* Depends:
* mutations.attr.js
* mutations.html.js (optional)
*/
(function($) {

$.ie6css = {

// Convert an attribute name and value into CSS class names
classNames: function( attr, value ) {
return value ? attr + value.replace(/(^|\s+)(?=\S)/g, ' '+attr+'-') : '';
},

// A selector or function for filtering elements to perform conversion on
filterElem: '*',

// A function to filter attributes to perform conversion on
// (MUST filter by element too, exactly as filterElem would.)
filterAttr: function( elem, attr ) {
return true;
},

setup: function() {
$(document)
.bind('attr.ie6css', function(event) {
if ( event.attrName !== 'class' && $.ie6css.filterAttr.call(event.target, event.attrName) ) {
$(event.target)
.removeClass($.ie6css.classNames.call(event.target, event.attrName, event.prevValue))
.addClass($.ie6css.classNames.call(event.target, event.attrName, event.newValue));
}
})
.bind('html.ie6css', function(event) {
$('*', event.target)
.filter($.ie6css.filterElem)
.each(function() {
var classes = $(event.target.attributes).map(function() {
return this && this.nodeName !== 'class' &&
$.ie6css.filterAttr.call(event.target, this.nodeName) ?
$.ie6css.classNames.call(event.target, this.nodeName, this.nodeValue) : '';
}).join(' ');

if ( classes ) {
$(event.target).addClass(classes);
}
});
});
},

teardown: function() {
$(document).unbind('.ie6css');
}
};

})(jQuery);

0 comments on commit b3f4ef8

Please sign in to comment.