Zhongde Liu

This is my personal "Clipboard" of web development stuff I come across


Leave a comment

Note: Whitespace raises jQuery error (Ajax, jQuery 1.9)

Just stumbled upon a bug/feature when migrating to jQuery 1.9.

So the case is: You are trying to convert following String:

"   <div>Hallo</div>"

into a jQuery object. Pay attention to the leading whitespace.

Prior to 1.9 you get what you would expect. With 1.9, you will get an error.  Reason is this core change, documented here http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring. As I’m not the only one with this issue, there are already several posts about it (the intention, the pros, contras…). This is the according thread in the jQuery tracker: http://bugs.jquery.com/ticket/13223 .

There is also mentioned to re-implement the old behavior.

Advertisements


Leave a comment

Note: Fontpath for Compass

In the latest project using a sass/compass development environment, I had problems to get the fonts referenced correctly, after the scss had been converted to css.

But there is a (yet undocumented) config variable named “fonts_dir“, analogue to the other standard variables like css_dir, sass_dir and javascripts_dir, which compass uses in order to generate the correct path.

So add it to your config.rb and you are ready to go!