Off To RailsConf and @media America

Just breaking radio silence briefly to say that I’m off to the states (again) to speak at RailsConf in Portland 17th-20th then on to @media America in San Francisco for the 21st-28th. I’m going to be doing presentations both called ‘The Mysteries Of JavaScript-Fu’, both with an old skool kung fu theme but quite different aside from that. If you are around in either of these places or have any tips on good skate and sneaker stores then drop me a line….I’m always up for a couple of cold ones or/and sneaker shopping missions.

When I get I’ll be working a load more on Low Pro and blogging more about it. It’s developing quickly at the moment as Prototype picks up momentum and it’s getting some damn good features. In the meantime, you could always check out the trunk and see the new features that have already gone in. Build the trunk release then try as a sneak preview:

$('an_element').wrap('<strong>');

Also, look out for a major new set of features for Event Wax scheduled for release round about the time of @media London.

17 Comments (Closed)

Are these changes in Low Pro available from anywhere?

Oh, and btw, its:
$('an_element').wrap('strong');

Tobie LangelTobie Langel at 15.05.07 / 23PM

Tobie: Heh, actually wrap() is something I’ve just added to Low Pro…is a version in the DOM branch of Prototype too? The code sample is correct for Low Pro’s version as I’ve added some stuff that will convert HTML snippets to DOM elements automatically via $ in a jQuery style. Just an experiment at the moment but that’s what I was demonstrating here.

The code is available via my SVN….see the trunk like above or try:

http://svn.danwebb.net/external/lowpro/trunk/

DanDan at 15.05.07 / 23PM

Woops…

Yes, Element#wrap just made it in Prototype trunk.

Here’s the code:

Element.wrap = function(element, wrapper) {
  element = $(element);
  wrapper = wrapper || 'div';
  if (typeof wrapper == 'string') wrapper = new Element(wrapper);
  else Element.extend(wrapper);
  element.parentNode.replaceChild(wrapper, element);
  wrapper.appendChild(element);
  return element;
}

You can pass it either an element, a tagName or nothing (in which case it defaults to wrapping it in a div).

It relies on the new Element constructor which you can read more about on the Prototype blog.

The main difference between LowPro’s and Prototype’s implementations is that, in Prototype, the element is returned rather than the wrapper. There was quite a bit of discussion about that, as you can imagine, but it seemed like the least surprising solution.

We’ve also completely refactored Insertions and Position, more about that in the changelog if you’re interested.

Tobie LangelTobie Langel at 16.05.07 / 00AM

Sorry, the link I posted to the changelog above is incorrect. Here’s the correct one

Oh, and have fun with your presentations. I unfortunately can’t attend either of them, will you make your slides available here ? That would be great!

Tobie LangelTobie Langel at 16.05.07 / 01AM

Dan: for shame! At least subscribe to the RSS feed of Subversion commits so you can keep up with what’s being added.

Better yet: make an appearance in Basecamp so we can talk about the event stuff being considered for 1.6.

Andrew DupontAndrew Dupont at 16.05.07 / 02AM

Dan: for shame! At least subscribe to the RSS feed of Subversion commits so you can keep up with what’s being added.

Better yet: make an appearance in Basecamp so we can talk about the event stuff being considered for 1.6.

Andrew DupontAndrew Dupont at 16.05.07 / 02AM

Nike is based in Portland, so they had better have some sneaker shops. To be honest, I’m not too familiar with Portland shops, but I’m sure we can find some.

See you there!

topfunkytopfunky at 16.05.07 / 03AM

Andrew, Tobie: Yes, I’m slack. I’ll stop it now and stay on top of whats going on. I’ll back out wrap. Im planning on making the dom builder depend on the new Element stuff as soon as it gets into a main version of Prototype. I’ll also pull out onReady when its in. At this rate Low Pro will just become a behavior library which is a good thing.

topfunky: Excellent, of course Nike is based here…got to be good.

DanDan at 17.05.07 / 02AM

Hi again,

FYI, new Element() is already in 1.5.2pre0 (svn trunk).

Tobie LangelTobie Langel at 17.05.07 / 05AM

Tobie: My current policy with Low Pro is not to change things until Prototype has them in the stable version as is downloadable on the site som I’m going to wait for a small while

DanDan at 17.05.07 / 10AM

Dan: Since Element.wrap is not yet in a stable version, you can add it to Low Pro if you like — I’m not sure what the timetable is for the 1.5.2 release. Just make sure it behaves the same way as the method in trunk.

Andrew DupontAndrew Dupont at 17.05.07 / 16PM

Dan, I wasn’t implying that you should add it now.

Tobie LangelTobie Langel at 17.05.07 / 18PM

I do prefer the:

element.wrap(““);

approach over jquerys:

element.wrap(““);

just don’t see the point of specifying start and end tags…but i still think your a bunch of thieving ba$tards leave jQuery to be the best :P

madmarv187madmarv187 at 17.05.07 / 18PM

damn html!

I meant:

element.wrap(“<strong>“);

over:

element.wrap(“<strong></strong>“);

madmarv187madmarv187 at 17.05.07 / 19PM

Is is possible to get the slides you used for the railsconf presentation?

Josh MartinJosh Martin at 22.05.07 / 05AM

any more clues on the eventwax features?

cdbraggcdbragg at 29.05.07 / 12PM

“Is is possible to get the slides you used for the railsconf presentation?”

I dont know at all but i hear that is possible (I dont know how yet.)

sitsit at 13.07.07 / 11AM

About This Article