none
Text Search (Ctrl+F) not matching text with newline in IE

    Question

  • There seems to be a bit of an issue someone pointed out to me when trying to search for text on HTML pages in IE. I've only tested this on IE 11, but its probably across most versions.

    If their is some multi-word text spanning multiple lines without a space at the end of the line, the Ctrl+F feature in IE does not seem to match the text. Firefox and IE  match and identify all 4 instances of the text in the example below fine, but IE fails to match two instances.

    While in the sample below it seems relatively minor. However we have 100's of HTML pages(some quite long) and many users rely on Ctrl+F within the page to find text phrases. Is there any way to fix this odd behavior  or is it a bug in IE? The only workaround seems to be to try and ensure any text that has line breaks in code has a space at the end of line. 

    Example HTML file:

    <html><body>
    <p>ABC DEF</p>
    <p>ABC
     DEF</p>
    <p>ABC 
    DEF</p>
    <p>ABC
    DEF</p>
    </body></html>




    • Edited by gsan2k Thursday, November 10, 2016 6:12 AM
    Thursday, November 10, 2016 5:37 AM

All replies

  • Hi,

    You did not mention which documentMode or encoding your sample web page is using or whether you have deployed Enterprise Mode Site lists for legacy intranet assets.

    f12>Emulation tab, will show the current documentMode (aka Emulation mode) and how it was established. eg. Quirks, IE7, IE8, Enterprise Mode, IE9, IE10, Edge...

    MS Compatibility View Lists, x-ua header, user Compatibility view list, Enterprise Mode site lists....

    The Emulation mode established in turn determines which method is used in the Find in page tool... getSelection, selection.

    Please see Compatibility changes by version

    You can use the Emulation Mode dropdown on the dev tool to toggle the available documentModes up to IE11 to see if the Find on page behaviour changes with the documentMode.

    One would expect that only IE11's Edge mode would match the behaviour of the other web browsers.

    you can also feature test in the dev tool's console

    document.documentMode and document.compatMode, window.getSelection and document.selection

    Your sample markup is lacking a head section... if you intend to target modern standards, you should first validate and correct your markup at validator.w3.org/nu (use the direct input tab to copy and paste your markup into the validator if you do not have a public url)... with Eastern Asian content you need to specify utf-8 encoding and also ensure that the browsers View>Encoding settings include Unicode (UTF-8).

    If your are migrating legacy intranet sites, you need to

    Install and deploy Enterprise Site Mode lists.

    Then Using the IE11 dev tool's emulation tab to determine which IE emulation mode your intranet domains should use.....and update your Enterprise Site Mode lists.... I would expect though any legacy sites that cannot be updated to IE11 emulation (aka Edge mode .... nothing to do with the MS Edge browser)

    Please see Compatibility changes by version

    Your sample markup looks familiar....although IE11 development has finished you can still submit feedback at https://connect.microsoft.com/ie

    Regards.

    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to raise a question, it's highly recommended you head on over to http://answers.microsoft.com/en-us

    For questions about html, css and scripting for website development or migration of legacy intranet sites, please post to

    http://stackoverflow.com/questions/tagged/internet-explorer


    Rob^_^


    Thursday, November 10, 2016 9:55 AM
  • The example provided was merely a very small example segment to reproduce the issues. I didn't think there needed to have exact and complete file markup, encoding, compatibility mode, ect...

    That being said, I did a little further testing using the x-ua header. The text search matches in all 4 cases correctly when the the browser mode is in 5, 7, or 8. If its set to 9, 10, or Edge(Default) though, the text search only matches the 2 instance of the text that have a trailing space in the first line of code.

    So do I have to force my site and pages into a backward compatible IE 8 mode despite them being valid and compatible with 11 or Edge? I thought browser compatibility was for legacy sites and content, not buggy newer browser functionality.

    Is there some new markup standard that I don't know about that states that in-order for text to match spaces shall only preceded line returns in code?
    Friday, November 11, 2016 1:50 AM
  • Hi gsan2k,

    only the webkit dev tool has an option to display whitespace placeholders, so writing one markup for all browsers is tricky, what you see in your development IDE (markup and whitespace/control characters) may not necessiarly be what you see in your target browser suite....

    <quote>

    Is there some new markup standard that I don't know about that states that in-order for text to match spaces shall only preceded line returns in code?

    </quote>

    A: no....

    no IDE is perfect, no userAgent is perfect or faultless, interpretations of 'the standards' vary between vendors....a great deal of progress has been made with the implementation of HTML5 and the release of its 'living standards', mainly because of the impassioned work of the w3c to provide detailed documentation to vendors, that spells out exactly how userAgents should parse the serialized markup stream of the server response, correct markup errors and marshal the presentation and scripting resources.

    but at this point in time, interoperability issues exist....as devs, we have to live with a middle ground...a living standard....(not faultless, not perfect in its implementation by browser vendors)

    You've correctly identified the issue....and you may realize that there is a workaround....use what works across your test browser suite...

    <p>text</p>

    not

    <p>

    text

    </p>

    As we all know the topic of this forum is

    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions.

    Some of the MS IE and Edge developers hang out and answer questions about html, css and scripting at the stackoverflow forum I mentioned. They may be able to provide a better workaround or directly raise an issue ticket for Find on page functionallity at the appropiate MS issue tracking portal...

    MVP's do not work for, nor do we represent MS.

    Regards.


    Rob^_^


    网络公民

    Friday, November 11, 2016 8:53 AM