Opened 15 years ago

Closed 15 years ago

#3582 closed defect (wontfix) inconsistent?

Reported by: dante Owned by: sjmiles
Priority: high Milestone: 1.0
Component: HTML Version: 0.9
Keywords: Cc:
Blocked By: Blocking:


in trying to document _base/html.js I noticed some weirdness in the way works ... not sure if is bug or improper use, but various 'styles' get interpreted differently on different browsers. eg, margin and padding: supposed to be 4 sets of values or four styles (margin:4px 4px 4px 4px or margin-top:4px; margin-bottom:4px; etc.) setting margin:4px in CSS makes return 0 for 'margin' in FF, but 4 in IE. colors in FF are returned as rgb(#,#,#) and #hex in IE ... in IE, a 'set margin' then calling getComputedStyle returns the 4 value string as expected, FF null.

testcase attached showing style info on a css-styled node, versus computedStyle of that node, then using to assign a style to a node, and then getting the new "style" value, and then re-running getComputedStyled ... some come back as undefined, some set styles and return nothing.

and cannot determine any useful way to know a node's border-properties, but can be set via,"borderColor","#000") or borderWidth or borderTop ... though returns null for each of the above.

Attachments (1)

style.html (3.4 KB) - added by dante 15 years ago.

Download all attachments as: .zip

Change History (5)

Changed 15 years ago by dante

Attachment: style.html added

comment:1 Changed 15 years ago by Adam Peller

Owner: changed from Bryan Forbes to sjmiles

comment:2 Changed 15 years ago by sjmiles

Status: newassigned

When setting properties, is using a CSSStyleDeclaration interface (viz. That interface allows you to set properties using shorthand notations, e.g. "margin: 2px" is actually setting all four margin properties.

When inspecting properties is using a CSS2Properties interface (viz. getComputedStyle). Therefore combined properties like "margin" or "border" are (generally) not available. Only specific properties should be queried, e.g., "marginLeft" or "borderRightWidth" (see the property list linked above).

Note that for common metrics, attempts to return (numeric) pixel values parsed out of the strings that would normally be returned from getComputedStyle. By the same token, I imagine colors should be normalized. Todo: make a separate ticket for that.

All this flows from the way CSS support is designed on browsers. Fwiw, personally, I'm not fond of, because these details become magic (but therefore also convenient).

comment:3 Changed 15 years ago by sjmiles

Summary: horribly inconsistant? inconsistent?

comment:4 Changed 15 years ago by sjmiles

Resolution: wontfix
Status: assignedclosed
Note: See TracTickets for help on using tickets.