Range clonecontents issue in Mac Sarari

I have selected a element node using range.selectNode(node) and added the range into the window selection. If I get range.cloneContents() from the selection, it returns fragment. Fragment contains only text node. This happens in Safari only. Kindly do needful fellas.

Example:
HTML: ```
node contents


    Script:
        range = document.createRange()
        node = document.querySelector('.select')
        range.selectNode(node)
        selection = window.getSelection()
        selection.removeAllRanges()
        selection.addRange(range)

        newRange = selection.getRangeAt(0)
        console.log(newRange.cloneContents()) //returns text node "node contents"

Browser: Sarari 9
OS: MAC

Thanks in advance.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.