Permalink
Browse files

Version 1.4.1

  • Loading branch information...
1 parent 876321b commit d2643f686f626d310404c57ebef128ad196b62b4 @glebm committed Jul 21, 2011
Showing with 28 additions and 23 deletions.
  1. +2 −0 README.md
  2. +1 −1 build.sh
  3. +11 −6 dombrew.coffee
  4. +13 −15 dombrew.js
  5. +1 −1 dombrew.min.js
View
@@ -69,6 +69,8 @@ You will need node and coffee-script installed:
* npm install -g coffee-script
# Changelog / What's new
+v1.4.1:
+* IE7 $b(nodes...) fix
v1.4:
View
@@ -8,7 +8,7 @@ coffee -bp dombrew.coffee > dombrew.js
echo "Building dombrew.min.js..."
#java -jar compiler.jar --js dombrew.js > dombrew.min.js
-uglify-js -nc --unsafe dombrew.js > dombrew.min.js
+uglifyjs -nc --unsafe dombrew.js > dombrew.min.js
echo "Building dombrew.min.js.gz to check the size..."
gzip -c9 dombrew.min.js > dombrew.min.js.gz
View
@@ -29,7 +29,7 @@ class Node
pos = elemType.length
classes = attr['class']
for piece in pieces
- (elem[pos] == '#') && (attr['id'] = piece) || classes.push(piece)
+ (elem.charAt(pos) == '#') && (attr['id'] = piece) || classes.push(piece)
pos += piece.length + 1
delete attr['class'] unless attr['class'].length
elemType
@@ -38,8 +38,13 @@ class Node
# joinValues('a') => 'a'
joinValues = (value) ->
return value if typeof value != 'object'
- (piece for piece in value when piece).join(' ')
- return
+ r = []
+ i = -1
+ length = value.length
+ while (++i < length)
+ r.push(value[i]) if value[i]
+ r.join(' ')
+
constructor: (elem, attr, more) ->
attr ||= {}
@@ -93,17 +98,17 @@ Node::asHTML = Node::html
@DOMBrew = D = ->
a = arguments
# If passed an array, wrap it in a DocumentFragment
- if (typeof a[0])[0] == 'o' && 'splice' of a[0] # $b([nodes...]) form
+ if (typeof a[0] == 'object') && ('splice' of a[0]) # $b([nodes...]) form
nodes = a[0]
- else if a.length > 1 && (typeof a[1])[0] == 'o' && ('_brew' of a[1]) # $b(nodes...) form
+ else if a.length > 1 && (typeof a[1] == 'object') && ('_brew' of a[1]) # $b(nodes...) form
nodes = a
if nodes
frag = d.createDocumentFragment()
frag.appendChild(node.e) for node in nodes
a = [frag]
new Node(a[0], a[1], a[2])
-D.VERSION = D.version = '1.4'
+D.VERSION = D.version = '1.4.1'
# innerText fix (Firefox)
if (H = HTMLElement) && !H::innerText && H::__defineGetter__ && H::__defineSetter__
View
@@ -35,7 +35,7 @@ Node = (function() {
classes = attr['class'];
for (_i = 0, _len = pieces.length; _i < _len; _i++) {
piece = pieces[_i];
- (elem[pos] === '#') && (attr['id'] = piece) || classes.push(piece);
+ (elem.charAt(pos) === '#') && (attr['id'] = piece) || classes.push(piece);
pos += piece.length + 1;
}
if (!attr['class'].length) {
@@ -44,21 +44,19 @@ Node = (function() {
return elemType;
};
joinValues = function(value) {
- var piece;
+ var i, length, r;
if (typeof value !== 'object') {
return value;
}
- ((function() {
- var _i, _len, _results;
- _results = [];
- for (_i = 0, _len = value.length; _i < _len; _i++) {
- piece = value[_i];
- if (piece) {
- _results.push(piece);
- }
+ r = [];
+ i = -1;
+ length = value.length;
+ while (++i < length) {
+ if (value[i]) {
+ r.push(value[i]);
}
- return _results;
- })()).join(' ');
+ }
+ return r.join(' ');
};
function Node(elem, attr, more) {
var css, name, prop, s, value;
@@ -134,9 +132,9 @@ Node.prototype.asHTML = Node.prototype.html;
this.DOMBrew = D = function() {
var a, frag, node, nodes, _i, _len;
a = arguments;
- if ((typeof a[0])[0] === 'o' && 'splice' in a[0]) {
+ if ((typeof a[0] === 'object') && ('splice' in a[0])) {
nodes = a[0];
- } else if (a.length > 1 && (typeof a[1])[0] === 'o' && ('_brew' in a[1])) {
+ } else if (a.length > 1 && (typeof a[1] === 'object') && ('_brew' in a[1])) {
nodes = a;
}
if (nodes) {
@@ -149,7 +147,7 @@ this.DOMBrew = D = function() {
}
return new Node(a[0], a[1], a[2]);
};
-D.VERSION = D.version = '1.4';
+D.VERSION = D.version = '1.4.1';
if ((H = HTMLElement) && !H.prototype.innerText && H.prototype.__defineGetter__ && H.prototype.__defineSetter__) {
H.prototype.__defineGetter__("innerText", function() {
return this.textContent;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit d2643f6

Please sign in to comment.