<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>10583</bug_id>
          
          <creation_ts>2010-09-08 23:37:40 +0000</creation_ts>
          <short_desc>[Selection] toString should return only the text within the selection that is visible to the user</short_desc>
          <delta_ts>2015-04-13 20:14:06 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Selection API</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc>https://w3c.github.io/selection-api/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>10798</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          <cc>annevk</cc>
    
    <cc>ayg</cc>
    
    <cc>benjamp</cc>
    
    <cc>ehsan</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>public-webapps</cc>
    
    <cc>timdown</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>38709</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2010-09-08 23:37:40 +0000</bug_when>
    <thetext>Section: http://www.whatwg.org/specs/web-apps/current-work/#selection

Comment:
toString does not represent what WebKit and Mozilla do, which is to return
only the text within the selection that is visible to the user.

Posted from: 77.44.46.22</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38730</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Down">timdown</who>
    <bug_when>2010-09-09 08:13:20 +0000</bug_when>
    <thetext>*** Bug 10584 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>38732</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Down">timdown</who>
    <bug_when>2010-09-09 09:05:38 +0000</bug_when>
    <thetext>I submitted this bug. Consider the following example HTML with selection delimited by pipes:

&lt;div&gt;|One&lt;script&gt;var x = 1;&lt;/script&gt;two|&lt;/div&gt;

Calling toString() on a Range representing that selection would produce
&quot;Onevarx = 1;two&quot;, while calling toString() on the Selection object in both Mozilla and WebKit will produce &quot;Onetwo&quot;. The latter behaviour is contrary to HTML5&apos;s specified behaviour, according to which it should return the same string as the Range:

&quot;Objects implementing this interface must stringify to a concatenation of the
results of invoking the toString()  method of the Range object on each of the
ranges of the selection, in the order they appear in the list (first to last).&quot;

This section of the spec is too simplistic, since major browsers have historically done something more subtle (i.e. returning a concatenation of only the text that is visible to the user within each selection range).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39488</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-26 17:12:57 +0000</bug_when>
    <thetext>It seems it&apos;s even more subtle than that... if I take your example but make the script element display:block, I get the script&apos;s contents with newlines around it in the .toString() output.

I really don&apos;t want to make HTML depend on detailed CSS stuff for its definitions.

Anne, is there anything I can reference that can define this? Ms2ger, is there any chance you can take Selection wholesale and put it in DOM Range?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39491</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2010-09-26 17:19:38 +0000</bug_when>
    <thetext>It very much sounds like innerText. I am not sure where exactly that needs to be defined.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44981</commentid>
    <comment_count>5</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-02-01 19:00:44 +0000</bug_when>
    <thetext>I&apos;m working on this, along with innerText (it will be the same algorithm for both).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57176</commentid>
    <comment_count>6</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2011-09-22 19:31:10 +0000</bug_when>
    <thetext>Moving Selection-related bugs to editing: see bug 14248, bug 14252.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104123</commentid>
    <comment_count>7</comment_count>
    <who name="Ben Peters">benjamp</who>
    <bug_when>2014-04-21 21:10:10 +0000</bug_when>
    <thetext>Moving to Selection API component.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>