Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8172

Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C

From Matt McDonald <matt@fortybelow.ca>
Newsgroups comp.lang.javascript
Subject Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C
Date 2011-11-09 09:29 -0700
Organization A noiseless patient Spider
Message-ID <j9e9pi$cks$1@dont-email.me> (permalink)
References <cf608eec-da40-4ff0-bfde-6722dfe12f8d@l19g2000yqc.googlegroups.com> <a0411f1d-53fe-4a8a-a068-a3e54fd0b48a@u10g2000prm.googlegroups.com>

Show all headers | View raw


On 11-11-08 9:13 PM, RobG wrote:
>    element.getAttribute('data-foo');
>
> "works" but
>
>    element.data-foo;
>
> does not.

Right, but a little bit of research by these hypothetical developers 
would reveal that the `dataset` object [0] houses connections to data-* 
attributes. Ergo, the `data-bar` attribute in  `<div 
data-bar="true"></div>` would be accessed via `[Element].dataset.bar`.

[0]: 
http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-dataset

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C David Mark <dmark.cinsoft@gmail.com> - 2011-11-08 04:17 -0800
  Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-08 17:41 +0000
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C David Mark <dmark.cinsoft@gmail.com> - 2011-11-08 10:35 -0800
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Andrew Poulos <ap_prog@hotmail.com> - 2011-11-09 06:56 +1100
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-08 21:34 +0100
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-11-09 12:16 +0100
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Scott Sauyet <scott.sauyet@gmail.com> - 2011-11-09 05:51 -0800
      Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Andrew Poulos <ap_prog@hotmail.com> - 2011-11-10 07:09 +1100
        Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Scott Sauyet <scott.sauyet@gmail.com> - 2011-11-10 18:45 -0800
      Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C David Mark <dmark.cinsoft@gmail.com> - 2011-11-10 06:43 -0800
  Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C SteveYoungTbird <stephen.young@chello.at> - 2011-11-08 19:17 +0100
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C David Mark <dmark.cinsoft@gmail.com> - 2011-11-08 10:34 -0800
  Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C "S.T." <anon@anon.com> - 2011-11-08 17:13 -0800
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Andrew Poulos <ap_prog@hotmail.com> - 2011-11-09 12:21 +1100
  Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C RobG <rgqld@iinet.net.au> - 2011-11-08 20:13 -0800
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Matt McDonald <matt@fortybelow.ca> - 2011-11-09 09:29 -0700
      Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C RobG <rgqld@iinet.net.au> - 2011-11-09 15:36 -0800
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C David Mark <dmark.cinsoft@gmail.com> - 2011-11-10 06:52 -0800
  Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C Tim Down <timdown@gmail.com> - 2011-11-09 14:41 -0800
    Re: David Mark's Javascript Tip of the Day - Volume #1 - #Tip 14-C David Mark <dmark.cinsoft@gmail.com> - 2011-11-10 06:44 -0800

csiph-web