Question about finding nbsp on the page

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
Alexium 67
Fanatic
Fanatic
Posts: 122
Joined: 2015-07-13, 10:34
Location: Russia

Question about finding nbsp on the page

Unread post by Alexium 67 » 2019-09-09, 16:54

Is it possible to use find function (Ctrl+F) for find nbsp on the page? If I'm right that symbol is "copyable". But Pale Moon tries to find common spaces if I paste nbsp to the search textbox. Is it feature easy to add in future releases?

Thanks.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4980
Joined: 2015-12-09, 15:45
Contact:

Re: Question about finding nbsp on the page

Unread post by moonbat » 2019-09-10, 04:16

Easier to search the page source. Just select 'View page source' from the rightclick menu on the page, then search the editor that pops up for the html.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

Alexium 67
Fanatic
Fanatic
Posts: 122
Joined: 2015-07-13, 10:34
Location: Russia

Re: Question about finding nbsp on the page

Unread post by Alexium 67 » 2019-09-10, 06:59

View page source may be non optimal if I use search in a text fields in some web text editors. There are some special web tools for the work with the text. Yes, I know, there are other workarounds already. But it will be more comfortable if Pale Moon will support nbsp input.

I don't know what kind of code define this feature and how do it hardcoded. So it may be too many human work to implement it to Pale Moon.

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Question about finding nbsp on the page

Unread post by therube » 2019-09-10, 12:20

On a "rendered" page, there is not going to be any   to be found, no?
Only what it represents, which is going to be space(s).
To the rendered page,   is a space, no?


nbsp_test.html:

Code: Select all

<div style="width:45px; height:45px; border: solid thin red; overflow: visible">
    Hello&nbsp;There
</div> 

<br />

<div style="width:45px; height:45px; border: solid thin red; overflow: visible">
    Hello There
</div>

<br>
<div>
    Hello There You Swine
</div>

<br>
<div>
    Hello&nbsp;&nbsp;&nbsp;There&nbsp;&nbsp;&nbsp;You&nbsp;&nbsp;&nbsp;Swine
</div>

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Question about finding nbsp on the page

Unread post by therube » 2019-09-10, 12:23

Maybe you could create a bookmarklet to search the page (source) for &nbsp; highlighting those entries in the rendered page.

Alexium 67
Fanatic
Fanatic
Posts: 122
Joined: 2015-07-13, 10:34
Location: Russia

Re: Question about finding nbsp on the page

Unread post by Alexium 67 » 2019-09-11, 18:45

I can't understand about the "rendered" page. Some page (Discord web chat for example) can show me nbsp. Yes, it rendered as space. But it will be nbsp in the clipboard if I mark it and copy. That copy I can paste to any third party editor (MS Word for example) and it will be pasted as nbsp.

But I can't re-find it on the page using search feature. Pale Moon is not support nbsp input probably

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Question about finding nbsp on the page

Unread post by Moonchild » 2019-09-11, 22:09

Why are you wanting to search for a whitespace character (breaking or non-breaking) anyway? What exactly is the point?
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Alexium 67
Fanatic
Fanatic
Posts: 122
Joined: 2015-07-13, 10:34
Location: Russia

Re: Question about finding nbsp on the page

Unread post by Alexium 67 » 2019-09-12, 11:39

Text editing in a web based tools mostly. Editing text with some errors. Translating text. It is the point. But I don't want be too pushy. This is my humble suggestion.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Question about finding nbsp on the page

Unread post by Moonchild » 2019-09-12, 18:28

I'm afraid not treating whitespace as whitespace would break searching for the more common case...
word[space]anotherword and word[nbsp]anotherword should both come up as a result if you search for "word anotherword"; that precludes searching specifically for whitespace/nonprinting characters.
So I'm afraid I won't be taking this suggestion.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Question about finding nbsp on the page

Unread post by therube » 2019-09-12, 19:46

This (bookmarklet) will search for "nbsp" (case sensitive) in the page source (& display an alert).

Code: Select all

javascript:if(document.documentElement.outerHTML.indexOf("nbsp") > -1) {  alert("NBSP!!!"); } else {  alert("NO nbsp"); }
So now, all you have to do is to get it highlight said found objects' location on the web page itself ;-).

And of course you could change it from searching for "nbsp" to "&nbsp;" or whatever...
(Suppose you'd actually want nbsp; and with that, you can see that nbsp; is even used on this page [as &nbsp; html-code, in addition to the textual "word" versions displayed here].)

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Question about finding nbsp on the page

Unread post by therube » 2019-09-12, 20:14

Maybe you can do something with userContent.css?


You can do something like this to "highlight" mailto: & .pdf "links".

Code: Select all

a[href^="mailto:"] {
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAOCAYAAAAi2ky3AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKhSURBVDgRBcFbTltXFIDhf62zj41tsH2MIYJWoiKMJlPpFPrYCXQCUaUOpa99jpQQhSSSiQM2Fx/7XPZt9ftktbr9YzZb/j6ZTDRZNEExAwAQAAwDAwEQMAynBQby8cNH3r//+0/Z19vbuulujoZHzGYzDMPMAAAQwAAABARQHC8vz6zvf+Ck5Pbzt89aWhGW1RLf92weH8kpoyKAAYZhgIEYBY4UMl/v7rj/vuJ8fsb54pycZaI++E6isZydolbwsH4g+IigWDLIhmShwPG02fLpwycIxtura8bjEw5tRwihdTlmQt+jolQnU+rDnofVTxanC8ajEZiQYuLu+xfquuby4oLpZI7vPT71+BjJhrkQgigOUSWlyPFoTNe0fPvylcXpgpwSq/t7To6n3FzfIAhN05BzxsdI6HtSir1LOSXvPVoUuMKxrbe0bcvZ8g37fU3fd5wuzlAV2q6DLKSYyZbwMRBjpjl00Xkf+6xKibDf79g3e+bzChFhNp0DgmVjV+/4cf+T2WxGoQUhRkKM9L1nMCi9y9lCMqNpdjRtS1XNwaDzHWKKZcMMXDlAtefhcUNVVWQzfIiEkNkfmugK5/Lz8wt921NVp6QkhBBAQMwwDAMwYzQeEVJks90ync6IIRKCJ6bk3dPz7un1qWZeVYQQCSGiqmQDBMAwA8PAYDA4ojk0PD48MpmM6UOk0CK51Xrzl+/6E5+5UZWTQnVaFm4IoKIggqiiKmAGBmU5pD480XQtZTkmxpyciP67bw7vsuaz4WD0a9eGX+rX58vRaHR9fDy9RrjMMV+kZG+0KI4KUYpCce6I190LMfZsts97ByCQVGQtImsV+a/tWtzQoaWUGIumaefe98vhcPSbSfG2f/VXMcYrkOvVap2KUv75Hys/o/G4MU5KAAAAAElFTkSuQmCC) !important;
  background-position: left center !important;
  background-repeat: no-repeat !important;
  padding: 7px 0 7px 20px  !important;
}

a[href$=".pdf"] {
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAKDSURBVDjLZdLNa1RXGIDx59xzcu6dZJwxMWOiIY3GD0TRoNIE0UVB6ZRQS0ilBYs7wRBRSReiuBDsP9B9obgR3ZgaxSy0jKBGaMBNx4DEKraS1GQ6ZvI1X/fe83ZREKXP/rd7lFy+wuRUnsOjN+nq7TvWn80eKC0u1j3PI45jJApJau3nn+Wf5nIPbmitY+ccRuL4YO/GDn2tZ5/3pHvb0FDvocOld0UkiggrZV4WCvg9uxn5fqQ2PHy6Y3x8/EegjrtwSeTrb0Q+OyKy91OR7q0inZtE2jukvrZFRts65PqdcRERmZ6eXhkcHDxnjEkYVSqtMDWVZKEEq2WolCGu4YBZYHp9O+7lH4yN3UZr3dTf/+XlXC73yLx+/DiZf/MXNo6RaoUKAkAIlIAgk6Gnr48X+d8Boa2tvTkIgk5TmJk59Hx1WT8BlR4YuHjy+HfZxaUlWjxFy+07tA4P07a5iw3NaZaXl0mnUxhjEiZt7cQrFHcRTm3ffmL3V0f5p1gk09jI0uQkdv9+lItJBAG1Wg3fD1BKGe9pFPETQgheEMcNqlYjaS31P18TVyp4Dx+RSKVozGTwUyms76OUMuZ4cZ73KUUQBDhtiG6NEZw+Q/jrfby3s9hdO/FRNOzYAUrh8UFaa6y1hBMTxAtLmMI8du8+otm/Wb35C/HPV9GFIspazEewKYnkp6iPjpIYGsLr/AS3pgn1xedU5gus3rtPwkW4MPwYVn+bpF58h5/N4rZ0U15ZIZxZIKyHRM5R2bOLUkPD/6Bas7lL+yNncZn1VKMIqzXK+oCCMMSUI7QPSimtPoCJ5tbW8+l167511SrinAMQ+W8IEcE5Z5VSC3Nzcz/8Cz6tG4sDpwFWAAAAAElFTkSuQmCC) !important;
  background-position: left center !important;
  background-repeat: no-repeat !important;
  padding: 7px 0 7px 16px  !important;
}
Maybe something similar can be done to "highlight" nbsp; ?

Locked