TinyMCE removes empty element element on hitting backspace in editor. The element is used for styling purposes. The problem does occur in Firefox and not when using Chrome.
Steps to reproduce:
1. go to http://fiddle.tinymce.com/P0eaab (config adapted such that with class info is not cleaned)
2. click in the menu bar on "tools" and then on "Source code"
3. paste the following html code
<div class="eight columns row">
<h2>Tarieven seizoensopening 2014</h2>
Prijs per persoon per nacht met inbegrip van een uitgebreid ontbijt en 's avonds een culinair driegangenmenu (apero-wijn-water-koffie):
<ul class="list unstyled-list">
<li><i class="small-arrows"></i>Kamer 1: 125 € ppppn*</li>
<li><i class="small-arrows"></i>Kamer 2: 115 € ppppn*</li>
<li><i class="small-arrows"></i>Kamer 3: 115 € ppppn*</li>
<li><i class="small-arrows"></i>Kamer 4: 100 € ppppn*</li>
</ul>
</div>
Hit the "OK" button
Put cursor in editor window right behind the "5" in "125"
Hit backspace such that "125" is changed in "12"
Click in the menubar on "Tools" then on "Source code"
Expected result (only snippet with problem shown):
<li><i class="small-arrows">Kamer 1: 12 € ppppn*</li>
<li><i class="small-arrows"></i>Kamer 2: 115 € ppppn*</li>
Actual result (only snippet with problem shown):
<li>Kamer 1: 12 € ppppn*</li>
<li><i class="small-arrows"></i>Kamer 2: 115 € ppppn*</li>
Additional Notes:
-somehow the backspace did clean up the "" on the first li element
-performing the same experiment in chrome does not yield the error
-all plugins in FireFox were disabled in this test to avoid any interference
-is there a way to figure out what causes this removal of the i element? Can you actually use a debugger that shows "live" javascript action. I have Firebug but don't see how I can see the javascript live in action
It is so old question but maybe it will useful for someone.
You need add following setting in tinyMCE configuration
extended_valid_elements:'i[*]'
I will help only for "i" tag. So if you have other empry tags you need add it also here.
Related
Please check below my validation rule. But it's not working. I am sharing database table screen shot and error which getting.
'section.2.model_of_vehicle' => 'required|exists:vehicles,model_name|in:Ford Transit, Ford Tourneo, Volkswagen Crafter, Mercedes Sprinter, Toyota Prius Hybrid, Volkswagen Caddy Maxi, Renault Master, Peugeot Boxer, Vauxhall Vivaro, Vauxhall Movano, Other',
I want to have an XPATH which is able to select the date and time (like june 19 2020 at 08:59 pm) in all cases:
<span class="post_date"><span title="June 21, 2020 at 08:18 AM" currentmouseover="12">1 hour ago</span> <span class="post_edit" id="edited_by_2462600"> </span></span>
<span class="post_date" currentmouseover="62">June 19, 2020 at 08:56 PM <span class="post_edit" id="edited_by_2454907"> </span></span>
<span class="post_date" currentmouseover="157"><span title="June 20, 2020" currentmouseover="168">Yesterday</span> at 10:41 AM <span class="post_edit" id="edited_by_2457722"> </span></span>
I can get the second one easily with //*[#class="post_date"]/text(), but is there any way to get the 2 others and have 1 xpath for all cases? Or am I better off writting a function for this?
Thank you
Working XPath expression to select all dates with one expression :
(//#title|//text())[contains(.,", ") or contains(.," at ")]
Output : 4 nodes
EDIT : If you need something stronger (assuming all messages were posted after year 2000).
//span[#class='post_date']/span[contains(#title,', 20')]/#title|//span/text()[contains(.,' at ') and contains (.,':')][ancestor::*[1][self::span][#class='post_date']]
Or :
(//span[#class='post_date']/span[#title]/#title|//span/text()[ancestor::*[1][self::span][#class='post_date']])[contains(.,', 20') or contains(.,' at ')]
Output : 4 nodes
I need to check checkbox type label input by text on label.
Actually I would want to check the checkbox by these values Mon, Tue, Wed there in html tag, is it even possible?
The labels Mon Tue Wed ... are shown not like checkboxes, but look like buttons, basically i need to click on label or something...
My html looks like this:
<div id="ck-button"><label><input tabindex="-1" id="checkbox_aghdfklg"
name="checkbox_fdhadfadf" type="checkbox"><span>Mon</span></label></div>
<div id="ck-button"><label><input tabindex="-1" id="checkbox_0_aghdfklg"
name="checkbox_0_fdhadfadf" type="checkbox"><span>Tue</span></label></div>
<div id="ck-button"><label><input tabindex="-1" id="checkbox_1_aghdfklg"
name="checkbox_1_fdhadfadf" type="checkbox"><span>Wed</span></label></div>
...
...
<div id="ck-button"><label><input tabindex="-1" id="checkbox_5_aghdfklg"
name="checkbox_7_fdhadfadf" type="checkbox"><span>Sun</span></label></div>
I would be satisfied enough if I could check checkbox_0_blabla but this blabla part changes every time I edit or change something on my webpage.
I have tried some ways already:
find(:xpath, '//*[contains(#id, "checkbox_1_")]').click()
find(:xpath, '//*[contains(#id, "checkbox_1_")]').set(true)
but I keep getting errors like:
Unable to find xpath...
or
invalid selector
and so on..
Maybe someone has some ideas?
Thank You!
I have a variable address which for now is a long string containing some unneccessary info, eg: "Aboriginal Relations 11th Floor Commerce Place 10155 102 Street Edmonton AB T5J 4G8 Phone 780 427-9658 Fax 780 644-4939 Email gerry.kushlyk#gov.ab.ca"
Aboriginal Relations is in a variable called title, and I'm trying to call address.gsub!(title,''), but its returning the original string.
I've also tried address.gsub!(/#{title}/,'') and address.gsub!("#{title}",'') but those won't work either. Any ideas?
Sorry, the typo occurred when I typed it into stack overflow, heres the code and the output, copied and pasted:
(this is within a loop, so there will be multiple outputs)
p title
address.gsub!(title,'')
p address
output
"Aboriginal Relations "
"Aboriginal Relations 11th Floor Commerce Place 10155 102 Street Edmonton AB T5J 4G8 Phone 780 427-9658 Fax 780 644-4939 Email gerry.kushlyk#gov.ab.ca"
"Aboriginal Tourism Advisory Council "
"Aboriginal Tourism Advisory Council 5th Floor Terrace Building 9515 107 Street Edmonton AB T5K 2C3 Phone 780 427-9687 Fax 780 422-7235 Email foip.fintprccs#gov.ab.ca"
"Acadia Foundation "
"Acadia Foundation PO Box 96 Oyen AB T0J 2J0 Phone 403 664-3384 Fax 403 664-3316 Email acadiafoundation#telus.net"
"Access Advisory Council "
"Access Advisory Council 12th Floor Centre West Building 10035 108 Street Edmonton AB T5J 3E1 Phone 780 427-2805 Fax 780 422-3204 Email barb.joyner#gov.ab.ca"
"ACCM Benevolent Association "
"ACCM Benevolent Association Suite 100 9403 95 Avenue Edmonton AB T6C 4M7 Phone 780 468-4648 Fax 780 468-4648 Email accmmanor#shaw.ca"
"Acme Municipal Library "
"Acme Municipal Library PO Box 326 Acme AB T0M 0A0 Phone 403 546-3845 Fax 403 546-2248 Email aamlibrary#marigold.ab.ca"
likewise, if I try address.match(/#{title}/) I get nil.
I'm assuming you're using ruby 1.9 or higher.
It's possible that the trailing whitespace is a non-breaking space:
p "Relations\u00a0" # looks like a trailing space, but strip won't remove it
to get rid of it:
"Relations\u00a0".gsub!(/^\u00a0|\u00a0$/, '') # => "Relations"
A more generic solution for all unicode whitespace:
"Relations\u00a0".gsub!(/^[[:space:]]|[[:space:]]$/, '') # => "Relations"
To see what the character is in your case:
title[-1].ord # => 160 (example only)
'%x' % title[-1].ord # => "a0" (hex equivalent; example only)
title = title[0..-2] seemed to solve it. for some reason strip and chomp wouldn't work.
Terrible title, I know, but is there a way in XPath to get to a desired link by only knowing that the link is second going back from the last ellipsis?
In this instance, the desired link is /2
<div class="page">
1
2
3
...
50
51
52
</div>
In this case, it is /3.
<div class="page">
1
2
3
4
...
50
51
52
</div>
And, just to throw a spanner, in the works... this one is 21:
<div class="page">
1
2
3
...
18
19
20
21
22
...
50
51
52
</div>
I've tried all sorts of ways to get at it, from writing out counts to throwing magic beans out of my window, but nothing works. And now I'm out of magic beans. :(
Any suggestions for this problem (XPath, not the magic beans!) are welcome!
/div[#class='page']/text()[normalize-space()='…'][last()]/preceding-sibling::a[2]