Posts Tagged ‘API’

Sufferin Semantics! XML, HTML, jQuery, and MSIE

Thursday, February 4th, 2010

So, in a recent project, I’m consuming xml data and pulling out some text for a description field on an html page.  I’ve got some basic stuff, text for title information, paths to asset files stored as node attributes, the usual.  But something is bugging me.  I’ve included some html in my descriptions, all formatted according to xhtml standards, but it won’t be parsed by jQuery.

Dagnabit!  What is the point of combining xml and html standards if I can’t use them together all the time?  I know, you may be thinking, but xml is not html , no matter what you throw into your nodes.  You’re right, and this is exactly what jQuery tells us.  You can grab the text contents of any node, but if you have html tags in there, the .text() method in jQuery will just look right past them.  As it should.  This works fine, for little snippets like my titles, but what if I want to put some (ostensibly) well-formatted html code in my data?  Further, what about all those applications where you want to store html snips in a database and read them out in XML?  How do you get around this?

(more…)

The jsFloater API

Friday, December 4th, 2009

The API for jsFloater consists of 3 publicly available methods: floatHor, floatVer, and – you guessed it – floatHorVer.  The first of these will float an object horizontally; the second will float an object vertically, and the third will float an object both horizontally and vertically.

Because web browsers are anchored to the top left of the window, you may want to use a combination of these three methods to achieve your desired results.  jsFloater allows you to define a minimum stage size, so that your elements won’t crash together if the user squashes the page size down by dragging the browser window’s bottom right corner to the middle of the screen, for example.  This minimum stage size is passed to the class constructor on instantiation.

There is a visual guide to the API available both in the downloadable zip file and also for browsing on this site.  You can mouse over the various objects in the visual API guide to reveal what method has been used to float them, which align mode they are employing, and what their current pixel x – y coordinates are.

jsFloater allows you several types of floating, in addition to the ability to “pad” or “stick” your floats, as will be expained below.  The types of floating are proportional (based off of the difference between the minimum stage size and current stage size) or Strict, meaning based only on the current stage size.

The methods:

(more…)