SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 37 of 37
  1. #26
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,608
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    I haven't personally used object for this purpose, if it doesn't have support in the browsers I am interested in I'll use a method that doesn't require branching.
    You can get a single properly defined object to work correctly as a substitute for an iframe in all browsers except IE6. It is only if you need to support IE6 as well that you'd need to use a second object definition that references an activeX control to allow it to work for IE6. So with IE6 use now getting low enough to drop support for it the option of replacing iframes, applets, canvas etc with an object is becoming more and more practical.

    HTML Code:
    <object type="text/html" data="xiframe.htm"></object>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  2. #27
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,095
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Thanks for the info,

    In answer to your question "Why is iframe the best choice when it was declared to be obsolete many years ago when it was replaced by object?"
    Because it works in all the current popular browsers.

    When IE6 dies I will look at replacing it with object.

  3. #28
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Glad I didn't just take the first advice and a little conversation is actually going now.

    Though, we've actually redesigned some stuff (for other reasons) so I now don't need the custom RTE, but I'll still probably write my own (or at least start one) just for learning if nothing else.

    I think I'll probably check out using an object because that seems like the most semantic element to use (which is ironic since the object element's semantic meaning is that it's basically a catch-all =p).

  4. #29
    SitePoint Enthusiast bbengfort's Avatar
    Join Date
    Feb 2010
    Location
    Arlington, WA; Lisbon, ND; Columbia, MD
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    Set the content of the iframe to the content of textarea.
    enable contentEditable / designMode.
    Add a submit event listener on the form it's sitting in to copy the source from the iframe back to the textarea.
    Thanks- I think this may be the answer to the disconnect I was having with using a textarea with another element.

    Speaking of the other element:

    So the object element is more standards-compliant, but its partial implementation doesn't speak well for it. When using the object like a window, we are referencing external data- which is is the syntactical meaning of this element. Is there any usefulness in exploring the better implemented embed element for this purpose? Or is the object element simply better because it can contain other tags to be manipulated; in which case a div with contentEditable = true is basically the same?
    Last edited by bbengfort; Feb 7, 2010 at 14:27. Reason: added a reply to a quote.

  5. #30
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For sure this is hard so much so I think not so good to go ahead too much.

    There many text editors already that can do things too well!

    Charlie, Hanoi

  6. #31
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    The thing about divs with contentEditable = true, at least in FF is that it also lets you change the dimensions of the DIV container as well, which is quite undesirable.

    If someone knows how to stop that, I think div might be better (or at least equal to) the object element.

  7. #32
    SitePoint Enthusiast bbengfort's Avatar
    Join Date
    Feb 2010
    Location
    Arlington, WA; Lisbon, ND; Columbia, MD
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got Internet Explorer, Firefox, and Chrome to not allow resize by using the following CSS:

    Code CSS:
    #contentEditable {
    	position: fixed;
    	border: 1px solid #222222;
    	width: 600px !important; 
    	height: 400px !important;
    	padding: 5px;
    }


    The width and height and !important instructions seemed to work in Firefox and Chrome- they did not show resize handles at all. On Internet Explorer, things worked after I added
    Code CSS:
    position:fixed;
    but the resize handles still appeared when you clicked on the element.

    I also explored using JavaScript:
    Code JavaScript:
    onmousedown = event.preventDefault();

    But this is only for IE, and the CSS method worked better.

    I should mention, my div was wrapped in an object, I don't know how that effected things since I didn't do that much exploration before replying:

    Code HTML:
    <div id="wrapper">
    <h1>Rich Text Editor Test</h1>
    <object id="richtext" name="richtext">
    <div id="contentEditable" contentEditable="true">
    	<p>This is text to be edited.</p>
    </div>
    </object>
    </div>

    I would be interested in hearing your results.
    Last edited by bbengfort; Feb 8, 2010 at 11:37. Reason: Added more code

  8. #33
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,095
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by samanime View Post
    The thing about divs with contentEditable = true, at least in FF is that it also lets you change the dimensions of the DIV container as well, which is quite undesirable.
    I don't know what you mean, The div's aren't made resizable for me.
    If you mean it's dependant on the size of the content - that's just because that's how block level elements behave. You can add overflow: auto and a height if you want a scroll bar.

    @bbengfort I'm not sure sure of the question.

  9. #34
    SitePoint Enthusiast bbengfort's Avatar
    Join Date
    Feb 2010
    Location
    Arlington, WA; Lisbon, ND; Columbia, MD
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    I don't know what you mean, The div's aren't made resizable for me.
    Try it with Internet Explorer- it definitely has resize handles. With FireFox, I didn't get that default behavior, but I think its because I defined the width and height with CSS. It should be resize-able in Chrome, for the same reason TextAreas are, but same as FF with the CSS.

    Firefox Discussion about Resize Handles

  10. #35
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    Wait, so are they adding "contenteditable" as some part of the HTML or CSS spec?? Go. Team. Mozilla. : (

  11. #36
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,095
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    Wait, so are they adding "contenteditable" as some part of the HTML or CSS spec?? Go. Team. Mozilla. : (
    Like it or lump it, that's how the HTML 5 cookie crumbles. They have said 'This is the current state of the web, we'll start there'
    http://blog.whatwg.org/the-road-to-h...ontenteditable
    I personally like the attribute, html 5 is the spec for web applications and the form elements are pretty limiting. Go. Team. WHATWG. : )

    People have similiar gripes with how other de-facto standards like canvas have been put into the spec.

  12. #37
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    I didn't realise it was an HTML5 thing... I thought it was Mozilla trying to be as cool as webkit : )

    Lawlz, Mozilla trying to be as cool as webkit using M$ proprietary settings, LAWLZ.

    You know I'd much rather they fixed their decade-old ginormous rendering bugs, but we all know that'll never happen.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •