Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-3638

Range detection fails inside relative positioned elements in IE

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.1.1, 2.2 M1
    • 1.8.1, 1.9 M1
    • WYSIWYG Editor
    • None
    • Internet Explorer
    • range detection position relative
    • Unit
    • Very hard

    Description

      In order to detect the current selection inside the rich text area in Internet Explorer we use the offsetLeft and offsetTop element properties. It seems that when an element has position:relative the offsetLeft and offsetTop properties of its descendants have wrong values, or at least not following the definition from MSDN. Take for instance the following HTML snippet:

      <h1>
        <span>Title 1</span>
      </h1>
      <h2>
        <span>Title 2<br/>foo</span>
      </h2>
      

      If the second heading has position:static then its inner BR has (in standards mode)

      offsetLeft: 0
      offsetTop: 55
      offsetParent: HTML element
      

      After we set position:relative for the second heading the BR has:

      offsetLeft: 0
      offsetTop: 55
      offsetParent: H2 element
      

      The offsetTop property should have decreased because the new offsetParent is clearly not the first element on the page.

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: