Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

margin auto 在 position absolute element 上某些 case 的展现与浏览器不一致 #1284

Closed
temper357 opened this issue Mar 31, 2022 · 0 comments · Fixed by #1331
Closed
Assignees
Labels
bug Something isn't working

Comments

@temper357
Copy link
Contributor

使用的 Kraken 版本 | What version of kraken are you using

main

重现代码 | Code example:

// @TODO: margin auto alignment should not take effect on position absolute element.
  xit('replaced-width-004', async () => {
    let p;
    let div1;
    p = createElement(
      'p',
      {
        xmlns: 'http://www.w3.org/1999/xhtml',
        style: {
          'box-sizing': 'border-box',
        },
      },
      [
        createText(`Test passes if a filled blue square is in the `),
        createElement(
          'strong',
          {
            style: {
              'box-sizing': 'border-box',
            },
          },
          [createText(`upper-right corner`)]
        ),
        createText(` of an hollow black square and if there is `),
        createElement(
          'strong',
          {
            style: {
              'box-sizing': 'border-box',
            },
          },
          [createText(`no red`)]
        ),
        createText(`.`),
      ]
    );
    div1 = createElement(
      'div',
      {
        xmlns: 'http://www.w3.org/1999/xhtml',
        id: 'div1',
        style: {
          border: '1px solid black',
          direction: 'ltr',
          height: '200px',
          position: 'relative',
          width: '200px',
          'box-sizing': 'border-box',
        },
      },
      [
        createElement(
          'div',
          {
            style: {
              background: 'red',
              color: 'blue',
              font: 'NaNpx NaNpx',
              left: '100px',
              'margin-left': 'auto',
              'margin-right': 'auto',
              position: 'absolute',
              right: '100px',
              width: '100px',
              'box-sizing': 'border-box',
            },
          },
          [createText(`X`)]
        ),
      ]
    );
    BODY.appendChild(p);
    BODY.appendChild(div1);

    await snapshot();
  });

预期结果 | Expected results:
image

实际结果 | Actual results:
image

@temper357 temper357 added the bug Something isn't working label Mar 31, 2022
@temper357 temper357 self-assigned this Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant