Opened 8 years ago

Closed 8 years ago

#13145 closed defect (fixed)

LightboxNano doesn't play well with 1.6 data-dojo-type

Reported by: Nick Fenwick Owned by: Adam Peller
Priority: high Milestone: 1.7
Component: Dojox Version: 1.6.1
Keywords: dojox, lightboxnano, href, data-dojo-props Cc:
Blocked By: Blocking:

Description

LightboxNano? inspects _this.href, which will be null when the dijit is constructed from markup using data-dojo-type.

e.g.

<a href="bigimage.jpg" data-dojo-type="dojox.image.LightboxNano">

This will completely ignore the 'href' attribute, as plain attributes aren't passed to dijits the way they were with dojoType. The way to fix this, apparently, is to include a copy of the href in data-dojo-props, which seems wasteful to me:

<a href="bigimage.jpg" data-dojo-type="dojox.image.LightboxNano" data-dojo-props="href: 'bigimage.jpg'">

I'm a bit new to 1.6 and data-dojo-type, but it seems LightboxNano? needs fixing. Because it can be created programatically, it must either use _this.href (valid when created programatically) or n.href (valid when created from markup).

It's a one-line fix:

      _this.href = n.href || _this.href;

inserted just before the use of _this.href.

Demonstrated in this sandbox:

http://dojo-sandbox.net/public/faf6b/3

"Original without data-dojo-props" demonstrates the 'problem'.

'New' demonstrates the fixed dijit.

Am I simply misunderstanding the data-dojo-props situation in 1.6?

Change History (2)

comment:1 Changed 8 years ago by Nick Fenwick

I just read the 1.6 release notes:

"If degradation is a concern, duplicate native attributes in data-dojo-props and on the node reference, as widget parameters are no longer read from the node attributes individually."

I guess I'm a bit late to this party and the discussion on #11490 is long winded, too long didn't read all of it.

I imagine LightboxNano? will have to stay as it is, the href attribute must be duplicated inside data-dojo-props, and this ticket must be closed.

comment:2 Changed 8 years ago by dante

Milestone: tbd1.7
Resolution: fixed
Status: newclosed

fwiw, I believe the 1.7 parser handles both native attributes and data-dojo-props transparently. so marking this as fixed in 1.7 (though I've not personally tested this feature, I know it was on the roadmap after much discussion on the original ticket)

Note: See TracTickets for help on using tickets.