Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Safari PC 3.0.4 CSS DOM problem.
Old 01-16-2008, 10:55 AM Safari PC 3.0.4 CSS DOM problem.
svirid's Avatar
Experienced Talker

Posts: 34
Name: Dima
Location: Toronto, Canada
Trades: 0
Hi guys,

I am at the middle of my web2.0 application and everything was working fine, until I updated my version of Safari (PC) from 3.0 to 3.0.4

Application allows people to build there own htmls/ajax/javascript modules. When the page of the application is being rendered users code appears in the body of the page. Its fine for JS but not for CSS so I was moving CSS into the header

Code:
var children = frm.getElementsByTagName('style');
var len = children.length; 
obj.css = [];    
for(var i=0;i<len;i++) {            
  obj.css.push(children[0]);
  DH.appendChild(obj.css[i]);                        
}
It is successfully working in FF, IE, Opera, Safari 3, 3.0.3 (MAC&PC) but not in Safari 3.0.4

Any advice? Thank you
svirid is offline
Reply With Quote
View Public Profile Visit svirid's homepage!
 
 
Register now for full access!
Old 01-16-2008, 11:18 AM Re: Safari PC 3.0.4 CSS DOM problem.
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I know that safari cannot include an external JS file via either document.write nor element.appendChild; and I suspect that the same thing might be happening to you with CSS.

Edit: found it! Seems like those are safari restrictions.
http://www.howtocreate.co.uk/tutoria...domstylesheets
Quote:
Currently this is supported according to the DOM standard by Opera 9 and Mozilla/Firefox. It is partially supported by Safari, Konqueror and ICEbrowser, but their support is so bad it is largely unusable.
Quote:
If you need compatibility with Safari, Konqueror, ICEbrowser, or any browser that does not support DOM Style Sheets (like iCab or Opera 8 or below), then you should ensure that your script does not requre document.styleSheets to be supported, and that if it uses it, it does not produce errors when something fails in one of these browsers.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-16-2008, 11:22 AM Re: Safari PC 3.0.4 CSS DOM problem.
svirid's Avatar
Experienced Talker

Posts: 34
Name: Dima
Location: Toronto, Canada
Trades: 0
Okay here is what I do I have an xml that contains

<xml >
<some html>
<script>
blalbalbalba.
</script>
<style>
.styles {}
</style>
<some html>
</xml>

this XML is loaded and inserted into the page, as page.appendChild();

the problem is that it has some styles, and they do not work in Safari in case they inserted into the body not in the head.
SO after I insert I move style tags into the had as head.appendCHild(css) it was working in Safari 3.0.3 and < but 3.0.4 its stopped working

Last edited by svirid; 01-16-2008 at 11:26 AM..
svirid is offline
Reply With Quote
View Public Profile Visit svirid's homepage!
 
Old 01-16-2008, 11:47 AM Re: Safari PC 3.0.4 CSS DOM problem.
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I tlooks like you have hit a bug of the browser to me, or that the bug was that it worked before, I don't know.

Try to fill a bug report, and see what the webkit team answer is:
http://webkit.org/quality/reporting.html
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-16-2008, 11:56 AM Re: Safari PC 3.0.4 CSS DOM problem.
svirid's Avatar
Experienced Talker

Posts: 34
Name: Dima
Location: Toronto, Canada
Trades: 0
Quote:
Originally Posted by tripy View Post
I tlooks like you have hit a bug of the browser to me, or that the bug was that it worked before, I don't know.

Try to fill a bug report, and see what the webkit team answer is:
http://webkit.org/quality/reporting.html
Will do thanks a lot,

do u know any DOM Inspector for Safari so I can see the actual DOM structure as Firebug shows me? I installed http://nightly.webkit.org but it give me only error console.

Thanks
svirid is offline
Reply With Quote
View Public Profile Visit svirid's homepage!
 
Old 01-16-2008, 12:15 PM Re: Safari PC 3.0.4 CSS DOM problem.
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Sadly not...
I believe webkit had one [ http://webkit.org/blog/41/introducin...web-inspector/ ] but I only have access to an old OSX PPC, for which the actual builds are incompatible, so I could not test it.

It would have made my js debugging easier thought...
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-16-2008, 12:26 PM Re: Safari PC 3.0.4 CSS DOM problem.
svirid's Avatar
Experienced Talker

Posts: 34
Name: Dima
Location: Toronto, Canada
Trades: 0
Thanks a lot for the useful links

by the way I just solved my problem, in case of the Safari I had to manually re-create style tag, works perfecto in any version of safari

Code:
var children = frm.getElementsByTagName('style');
        var len = children.length; 
        obj.css = [];    
        for(var i=0;i<len;i++) {    
            if(this._isSafari()) {
                obj.css.push(this._insertDOM(DH, {objType: 'style', type: 'text/css', text: children[0].innerHTML}, 'insertinto'));
                this.RemoveDOM(children[0]);
            } else {
                obj.css.push(children[0]);
                DH.appendChild(obj.css[i]);    
            }        
        }
svirid is offline
Reply With Quote
View Public Profile Visit svirid's homepage!
 
Reply     « Reply to Safari PC 3.0.4 CSS DOM problem.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26954 seconds with 12 queries