Just to clarify: .attr("height") no longer exists. --John
On Thu, Dec 17, 2009 at 11:47 AM, Karl Swedberg <k...@englishrules.com> wrote: > I'm curious about what the rationale was for having .attr('height') return > the same thing as .css('height'). Was it just in case people use the wrong > method? > I could see the usefulness of having .attr('height') return the actual > attribute value in cases where, for example, I needed to see whether the > current height of an element is less than or greater than the height set by > the attribute. > > --Karl > > On Dec 17, 2009, at 11:29 AM, John Resig wrote: > > I would be much more convinced if there were examples where: > 1) People were legitimately using inline-specified height/width and in > a way that was different from specifying the value in pixels and in > way that was superior to using CSS. > 2) The returned result from .height() (not .attr('height'), since > that's been temporarily disabled) was somehow different from the > expected value. > > For the moment ignore XML documents, I think it probably makes sense > to disable attrFn on XML documents. > > --John > > > > On Thu, Dec 17, 2009 at 6:45 AM, alexander farkas > <a.farkas...@googlemail.com> wrote: > > The way how jQuery does mixing properties with attributes is a very > > clever thing. One simple API for multiple different things is a very > > nice thing, but has its constraints. > > An example: > > jQuery returns the value-property on form-elements, instead of the > > value-attribute. This is a really good thing, because > > a) a lot of novice developers don´t know about the difference and are > > expecting this behavior > > b) more advanced developers know the difference, but want in general > > to know the value-property of a form element > > With other words the developer gets what he/she wants/expects here. > > But if jQuery starts to make .attr('height') equal to .height(), the > > behavior becomes very unexpected. Everybody knows that the height- > > attribute can be simply "overridden" by using css. This is why a > > developer would use height to get the height-dimension of an element > > and if a developer wants to know what the height-attribute, he would > > call attr('height'). > > If you change your API to this behavior you will > > a) break existing code > > a) do unexpected things > > b) you don´t have a jQuery-method, wich returns the height-/width- > > attribute anymore > > To be clear: > > I think, you did a great job mixing properties and attributes and if > > you know start to take this a step further, I am also on your side, > > but you have to make wisley decissions (and small steps) here. > > If you can solve the discrepancy in event-binding with attr, Robert is > > mentioing, it could be a nice feature, but please don´t do this with > > height/width! > > On 17 Dez., 11:28, Már Örlygsson <mar.orlygs...@gmail.com> wrote: > > Never ever, would I have guessed that .attr('height') would report a > > value on elements that don't have an explicit height `attr`ibute. > > Somehow I have the feeling that it would be useful for developers to > > be able to access plain old element attributes - in a cross-browser > > way - without any overt aliasing/magic. > > -- > > Már > > -- > > You received this message because you are subscribed to the Google Groups > "jQuery Development" group. > > To post to this group, send email to jquery-...@googlegroups.com. > > To unsubscribe from this group, send email to > jquery-dev+unsubscr...@googlegroups.com. > > For more options, visit this group at > http://groups.google.com/group/jquery-dev?hl=en. > > > > > -- > > You received this message because you are subscribed to the Google Groups > "jQuery Development" group. > To post to this group, send email to jquery-...@googlegroups.com. > To unsubscribe from this group, send email to > jquery-dev+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/jquery-dev?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > "jQuery Development" group. > To post to this group, send email to jquery-...@googlegroups.com. > To unsubscribe from this group, send email to > jquery-dev+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/jquery-dev?hl=en. > -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.