Skip to content
Browse files

check for incompatible .append() values for $var and stringify them

  • Loading branch information...
1 parent 52701f4 commit 2eab2d12e92b9f7e1431d53c22e7acd3c18dd1f7 @substack committed Jul 3, 2011
Showing with 11 additions and 1 deletion.
  1. +3 −0 empty.js
  2. +8 −1 jadeify.js
View
3 empty.js
@@ -0,0 +1,3 @@
+module.exports = function () {
+ throw new Error('This module is meant to be loaded with .use()');
+};
View
9 jadeify.js
@@ -33,9 +33,16 @@ module.exports = function (file, vars, opts) {
var elem = $('<div>')
.css('display', 'inline')
.attr('id', id)
- .append(value)
;
+ if (value instanceof $ || value instanceof window.HTMLElement
+ || typeof value === 'string') {
+ elem.append(value);
+ }
+ else {
+ elem.append(JSON.stringify(value));
+ }
+
var fn = function () {
Object.defineProperty(container.vars, key, {
set : function (x) {

0 comments on commit 2eab2d1

Please sign in to comment.
Something went wrong with that request. Please try again.