[Proto-Scripty] Re: element.getStyle('border') does not work
I tried that already. Also tried just with getStyle('border-width') but that gives nothing either. Other styles like background-color are returned well. On 23 dec, 18:02, Jane Hunter jane...@gmail.com wrote: reorder the border attributes so they are type, size, color and see if that solves your problem. On Thu, Dec 23, 2010 at 11:53 AM, marbrun marb...@me.com wrote: Hello guys I am using the latest version of JS Prototype, 1.7. I have never asked a question about JS Prototype online because I always figured it out somehow or just found another solution. But that's not true this time. In CSS, the border is set on an element like this: #element { border:#00 solid 3px; } Now I try to get the border value in JS Prototype with this code: $('element').getStyle('border'); And this is the return I get in Firebug: (an empty string) I have simplified all other code, so there nothing else influencing it. I have even tested this in another project using Prototype version 1.6. No result. How can I solve this quite important problem? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: element.getStyle('border') does not work
Great test! Strange thing are these results: $('test').measure('border'); - undefined $('test').measure('border-box-width') - 210 $('test').measure('width') - 200 #test { width:200px; border:solid 5px #00; } So even with the new measure and getLayout methods in JS Prototype 1.7 you would need to do the math yourself when you just want the border. Is this a bug? On 23 dec, 18:29, Walter Lee Davis wa...@wdstudio.com wrote: I just tried this with 1.6 and can report the following: * It works if you define the style inline (in the div's style tag). * It works if you set the attribute using Prototype Element.setStyle * It works for any simple attribute that does not have a composite- shortcut form, like width, no matter where in the CSS hierarchy that value was defined. * For anything that has a composite form, like margin (versus margin- left) the only way to get this to work is to set the property inline or by JavaScript (which I believe does the same thing as inline internally). (But this is not universally true for all attributes -- see below.) If you want to get the border property en toto, then you'll have to do the long-hand or JavaScript assignment. But if you want to reference a border-left-width in your code that is set outside of the style attribute on the tag itself, you will probably have to write your CSS in completely long-hand format: #foo { border-left-width: 2px; border-left-style: solid; border-left-color: #ccc; } I just discovered something else that's fairly alarming -- I defined margin-left: auto; on a div in the page head style tag, then asked for $('thatDiv').getStyle('margin-left') and got back 0px as the value. Doesn't matter where I define it, inline is no different. Firefox 3.latest with Firebug.latest. Walter On Dec 23, 2010, at 11:53 AM, marbrun wrote: I have simplified all other code, so there nothing else influencing it. I have even tested this in another project using Prototype version 1.6. No result. How can I solve this quite important problem? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: element.getStyle('border') does not work
It doesn't seem to be a Prototype-specific thing. `getComputedStyle` is just not giving back that information: http://jsbin.com/uyifa4 Except on Opera. It works on Opera. V. weird. FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Dec 23, 5:10 pm, marbrun marb...@me.com wrote: I tried that already. Also tried just with getStyle('border-width') but that gives nothing either. Other styles like background-color are returned well. On 23 dec, 18:02, Jane Hunter jane...@gmail.com wrote: reorder the border attributes so they are type, size, color and see if that solves your problem. On Thu, Dec 23, 2010 at 11:53 AM, marbrun marb...@me.com wrote: Hello guys I am using the latest version of JS Prototype, 1.7. I have never asked a question about JS Prototype online because I always figured it out somehow or just found another solution. But that's not true this time. In CSS, the border is set on an element like this: #element { border:#00 solid 3px; } Now I try to get the border value in JS Prototype with this code: $('element').getStyle('border'); And this is the return I get in Firebug: (an empty string) I have simplified all other code, so there nothing else influencing it. I have even tested this in another project using Prototype version 1.6. No result. How can I solve this quite important problem? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: element.getStyle('border') does not work
Doh! Not all that weird, I'd forgotten that `border-size` is a shorthand property! Works with full names: http://jsbin.com/uyifa4/2 Nice one, Walter! -- T.J. On Dec 23, 5:45 pm, T.J. Crowder t...@crowdersoftware.com wrote: It doesn't seem to be a Prototype-specific thing. `getComputedStyle` is just not giving back that information:http://jsbin.com/uyifa4 Except on Opera. It works on Opera. V. weird. FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Dec 23, 5:10 pm, marbrun marb...@me.com wrote: I tried that already. Also tried just with getStyle('border-width') but that gives nothing either. Other styles like background-color are returned well. On 23 dec, 18:02, Jane Hunter jane...@gmail.com wrote: reorder the border attributes so they are type, size, color and see if that solves your problem. On Thu, Dec 23, 2010 at 11:53 AM, marbrun marb...@me.com wrote: Hello guys I am using the latest version of JS Prototype, 1.7. I have never asked a question about JS Prototype online because I always figured it out somehow or just found another solution. But that's not true this time. In CSS, the border is set on an element like this: #element { border:#00 solid 3px; } Now I try to get the border value in JS Prototype with this code: $('element').getStyle('border'); And this is the return I get in Firebug: (an empty string) I have simplified all other code, so there nothing else influencing it. I have even tested this in another project using Prototype version 1.6. No result. How can I solve this quite important problem? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.