Skip to content

Clarification on button-layout 'behave as' definition and getComputedStyle().display discrepancy #11857

@lpas

Description

@lpas

What is the issue with the HTML Standard?

In the Button Layout Spec text found at https://html.spec.whatwg.org/multipage/rendering.html#button-layout, there is an ambiguity regarding the interpretation of the phrase "behave as 'inline-block'":

Otherwise, if the computed value of 'display' is a value such that the outer display type is 'inline', then behave as 'inline-block'.

The core question is: Does "behave as 'inline-block'" mean:

  • The element's computed value for display should change to 'inline-block', and its box model behaves accordingly? (As seen in Chrome/WebKit)

  • The element's computed value for display remains 'inline', but its box model is generated as if it were 'inline-block'? (As seen in Firefox)

Test Case Demonstrating Conflict

The current browser behavior is split:

let btn = document.createElement("button");
btn.style.display = "inline";
document.body.appendChild(btn);
console.log(getComputedStyle(btn).display);

Chrome/WebKit: inline-block
Firefox: inline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions