Skip navigation.

STICKY POST

Some Opera bugs and my whishlist (evolutive)

, , ,

Updated 2009-11-27

My Opera bugs



My Opera whishlist


How to change the user agent string

, ,

:no: OMG WARNING !!!
At the moment, the use of this setting makes gmail go wild. See this.



You may want to edit your user agent.
Maybe you want to insert a special text in order to recognize yourself in a server log file or anything like that.

Here is where you can insert any text in Opera's user agent string : opera:config#ISP : Id

Type anything you like in the ID text field then hit the save button and it is done.
You can see your User Agent here or there.

(It is called ISP because it is usually used by Internet Service Providers to put their name in when you install your web browser thanks to their CD)




As a bonus, here is where you can do the same thing in Internet Explorer. Of course, as usual, it is much more difficult than in Opera.

Read more...

PS3 browser CSS rendering bug

, , ,

I've spotted an irritating CSS rendering bug in the PlayStation 3 browser.

Block elements, like P tag, can get wider than their CSS width in the case of long text inside them.
This bug thus breaks many CSS layouts, adding unwanted padding to surrounding block elements or creating unaligned sibling block elements.

See there for a bug example : b512.html
You can see that, after having pressed the show bug button, the last paragraph gets wider/larger than the other by few pixels thus altering the layout of the whole column it is contained in.

The bug can be circumvented by adding an overflow-x: hidden CSS directive but that's still a bug and we shouldn't be doing all these patches to simple CSS.

I have sent an e-mail to playstation.com about this but I had noo reply since then. awww If someone has a working e-mail adress or bug report link to give me, that would be nice!

Thanks! :smile:

How to replace an element (HTML tag) by 100% pure DOM method

,

Replacing a page fragment has been an easy task with outerHTML until one would like to use the DOM methods for compatibility purpose. outerHTML (as innerHTML, innerText, outerText) is obviously not part of DOM and does not work in Firefox (for example).

But here is how to replace any element by anything just by knowing its id.

This code uses javascript methods available in DOM level 1. So it should work in every nowadays browsers. I tested it with Opera 9, IE 6 and Firefox 1.5

Here is the fragment we would like to replace :

<dl id="replaceme">
 <dt>Umbrella</dt>
 <dd>Parapluie</dd>
 <dt>Piper</dt>
 <dd>Pipo</dd>
</dl>



Here is what we would like to replace it with. In fact, we would like to add a few lines of tags around it. (As an example)

<blockquote style="border-left:thick solid blue" onclick=""alert('coucou')">
 <h6 style="text-decoration:underline">Glossaire</h6>
 <dl id="replaceme">
  <dt>Umbrella</dt>
  <dd>Parapluie</dd>
  <dt>Piper</dt>
  <dd>Pipo</dd>
 </dl>
</blockquote>
<p>Youpi bla bla bla</p>


And then here is the javascript code to make the switch. In fact, the last line replaces old with new replaceChild(new, old).

Note the cloneNode(deep) method which is very useful. It duplicates (copies) anything we want. Here we copy it inside our new fragment. If deep is at true (our case) it will copy all the childNodes of the element along with the specified element.

The rest of the lines is for building our tags with DOM methods. It is quite not as easy as with outerHTML and it is quit difficult to read, but it is standard.

embellish("replaceme");

function embellish(id) {
 var source= document.getElementById(id);

 /* new page fragment */
 var fragment= document.createDocumentFragment();

 /* new blockquote */
 var block= document.createElement("blockquote");
 block.style.borderLeft= "thick solid #333";
 block.style.paddingLeft= "4px";
 block.onclick= function() { alert("coucou"); };

 /* new header */
 var titre= document.createElement("h6");
 titre.style.textDecoration= "underline";
 titre.appendChild(document.createTextNode("Glossaire"));

 /* put header in blockquote */
 block.appendChild(titre);

 /* copy source in blockquote */
 block.appendChild(source.cloneNode(true));

 /* new paragraph */
 var para= document.createElement("p");
 para.appendChild(document.createTextNode("Youpi bla bla bla"));

 /* put blockquote in page fragment */
 fragment.appendChild(block)

 /* put paragraph in page fragment */
 fragment.appendChild(para);

 /* replace source with new fragment (contains a copy of source) */
 source.parentNode.replaceChild(fragment, source);
}


To see it in action, see my french page and click on the big button.

Hi there

This is my first test here in english :rolleyes:

Chào bạn

Ti chỉ thử viết trên Opera blog. :idea:

Ti thấy Opera blog vui quá ta !
Có lẽ là Ti sẽ viết ở đây thay vì Blogger...


Mà trước thế, nếu bạn muốn đọc tiếng Việt của Ti thì bạn cứ đi trên blog VIệt của Ti đây ! :up:

Salut Bob !

Salut Bob, c'est juste un essai :D hihi !
November 2009
M T W T F S S
October 2009December 2009
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30