[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

document.open

ram

1/1/2016 2:19:00 PM

The MDN documentation for »document.open« shows it with no
arguments:

document.open()

. But some other web pages give optional arguments:

document.open( MIMEtype, replace )

. But this does not seem to work with Mozilla Firefox 38.
OTOH, it does also not simply ignore the first argument.

Inserting the following code into the JavaScript console
of Mozilla Firefox 38 shows the page as intended. Note the
MIME type »text/html«:

document.open( "text/html", "replace" );
document.writeln
( '<!DOCTYPE HTML>'+
'<html lang="en">\r\n'+
'<head><meta charset="UTF-8"><title>Main</title><head><style type="text/css">\r\n'+
'</style></head></head><body>\r\n'+
' <p>hello, world</p>\r\n'+
'<pre><code><script type="application/javascript;version=1.8">\r\n'+
'</script></code></pre></body></html>\r\n' );
document.close();

. But when the MIME type is changed into »application/xhtml+xml«,
the document is not rendered as intended:

document.open( "application/xhtml+xml", "replace" );
document.writeln
( '<!DOCTYPE HTML>'+
'<html xmlns="http://www.w3.org/1999/x... lang="en" xml:lang="en">\r\n'+
'<head><meta charset="UTF-8"><title>Main</title><head><style type="text/css">\r\n'+
'</style></head></head><body>\r\n'+
' <p>hello, world</p>\r\n'+
'<pre><code><script type="application/javascript;version=1.8">/*<![CDATA[*/\r\n'+
'/*]]>*/</script></code></pre></body></html>\r\n' );
document.close();

. (This is intended to be a polyglot HTML5 document.)

Instead, it here shows the source code, which is the
argument of the »writeln« in the browser.

5 Answers

David Raleigh Arnold

11/1/2011 5:20:00 PM

0

On Nov 1, 10:08 am, "Ed S." <edspyhil...@gmail.com> wrote:
> "daveA" <d.raleigh.arn...@gmail.com> wrote in message
>
> news:43a6b104-6d85-4ae4-9afe-502c3bcc14d4@h24g2000yqm.googlegroups.com...
> On Oct 26, 11:32 pm, "Ed S." <edspyhil...@gmail.com> wrote:
>
> > Has anyone here heard of or used "Spaced Repetition" for learning? I've
> > come across some writings about using "spaced repetition" for learning
> > guitar. Seems like an undertaking that involves learning how I learn, as
> > opposed to how I should learn. Are there any articles for learning
> > "procedural" things like playing guitar, using "spaced repetition"?
>
> > Ed S.
>
> I think that most people try to do something like it for maintenance,
> not so
> much for learning. The principle isn't so important for material which
> can be easily relearned, and taking a fresh look at a piece may
> bring a new understanding. In that case, forgetting helps you learn!
>
> -----------------------------------------------------------------------------
>
> "...forgetting helps learning."
>
> I agree.
>
> What I see so far, in the case of the triads, is that after I write out all
> the combinations of triads and string sets and learn them, I can shrink down
> all the pages to individual memory cards with  first triad form on each
> string set, then play the entire sequence around the circle of fifths while
> I say the notes out loud.  Once the hint or each picture/question
> (non-verbal question?) is scanned into PDF format I could create a physical
> "deck" or just refresher pages.  I have the triads on chord charts/grids
> with the old school circled dot for root and larger dots for other notes,
> with the note names below the chart/grid.  I have one page for each
> iteration of inversions and string sets.  Using a computer just complicates
> the practice process unnecessarily.

Use notation instead of grids. Why? Because what you are doing has
nothing to do with playing the guitar, jazz or otherwise. Regards,
daveA

edspyhill01

11/2/2011 1:17:00 PM

0


"daveA" <d.raleigh.arnold@gmail.com> wrote in message
news:dbdb39e0-7565-49f1-8026-573d24c78ebb@hv4g2000vbb.googlegroups.com...
On Nov 1, 10:08 am, "Ed S." <edspyhil...@gmail.com> wrote:
> "daveA" <d.raleigh.arn...@gmail.com> wrote in message
>
> news:43a6b104-6d85-4ae4-9afe-502c3bcc14d4@h24g2000yqm.googlegroups.com...
> On Oct 26, 11:32 pm, "Ed S." <edspyhil...@gmail.com> wrote:
>
> > Has anyone here heard of or used "Spaced Repetition" for learning? I've
> > come across some writings about using "spaced repetition" for learning
> > guitar. Seems like an undertaking that involves learning how I learn, as
> > opposed to how I should learn. Are there any articles for learning
> > "procedural" things like playing guitar, using "spaced repetition"?
>
> > Ed S.
>
> I think that most people try to do something like it for maintenance,
> not so
> much for learning. The principle isn't so important for material which
> can be easily relearned, and taking a fresh look at a piece may
> bring a new understanding. In that case, forgetting helps you learn!
>
> -----------------------------------------------------------------------------
>
> "...forgetting helps learning."
>
> I agree.
>
> What I see so far, in the case of the triads, is that after I write out
> all
> the combinations of triads and string sets and learn them, I can shrink
> down
> all the pages to individual memory cards with first triad form on each
> string set, then play the entire sequence around the circle of fifths
> while
> I say the notes out loud. Once the hint or each picture/question
> (non-verbal question?) is scanned into PDF format I could create a
> physical
> "deck" or just refresher pages. I have the triads on chord charts/grids
> with the old school circled dot for root and larger dots for other notes,
> with the note names below the chart/grid. I have one page for each
> iteration of inversions and string sets. Using a computer just complicates
> the practice process unnecessarily.

Use notation instead of grids. Why? Because what you are doing has
nothing to do with playing the guitar, jazz or otherwise. Regards,
daveA

---------------------------------------------------------------------------------------------------

I plan to use notation later. I'm doing a proof of concept - know the
fretboard notes as accurately as I know the piano keyboard (just note
names), then learn the notation for each fret.

Check this out. Go to the end of the thread for the "edspyhill" post for an
example.

http://www.thestompbox.net/forum/showthread.php?11945-Fretboard-navigation-by-scale-interval-flashcards-just-posted&p=92672...

edspyhill01

11/2/2011 1:52:00 PM

0


"Ed S." <edspyhill01@gmail.com> wrote in message
news:9hcu7bF7q0U1@mid.individual.net...
>
> "daveA" <d.raleigh.arnold@gmail.com> wrote in message
> news:dbdb39e0-7565-49f1-8026-573d24c78ebb@hv4g2000vbb.googlegroups.com...
> On Nov 1, 10:08 am, "Ed S." <edspyhil...@gmail.com> wrote:
>> "daveA" <d.raleigh.arn...@gmail.com> wrote in message
>>
>> news:43a6b104-6d85-4ae4-9afe-502c3bcc14d4@h24g2000yqm.googlegroups.com...
>> On Oct 26, 11:32 pm, "Ed S." <edspyhil...@gmail.com> wrote:
>>
>> > Has anyone here heard of or used "Spaced Repetition" for learning? I've
>> > come across some writings about using "spaced repetition" for learning
>> > guitar. Seems like an undertaking that involves learning how I learn,
>> > as
>> > opposed to how I should learn. Are there any articles for learning
>> > "procedural" things like playing guitar, using "spaced repetition"?
>>
>> > Ed S.
>>
>> I think that most people try to do something like it for maintenance,
>> not so
>> much for learning. The principle isn't so important for material which
>> can be easily relearned, and taking a fresh look at a piece may
>> bring a new understanding. In that case, forgetting helps you learn!
>>
>> -----------------------------------------------------------------------------
>>
>> "...forgetting helps learning."
>>
>> I agree.
>>
>> What I see so far, in the case of the triads, is that after I write out
>> all
>> the combinations of triads and string sets and learn them, I can shrink
>> down
>> all the pages to individual memory cards with first triad form on each
>> string set, then play the entire sequence around the circle of fifths
>> while
>> I say the notes out loud. Once the hint or each picture/question
>> (non-verbal question?) is scanned into PDF format I could create a
>> physical
>> "deck" or just refresher pages. I have the triads on chord charts/grids
>> with the old school circled dot for root and larger dots for other notes,
>> with the note names below the chart/grid. I have one page for each
>> iteration of inversions and string sets. Using a computer just
>> complicates
>> the practice process unnecessarily.
>
> Use notation instead of grids. Why? Because what you are doing has
> nothing to do with playing the guitar, jazz or otherwise. Regards,
> daveA
>
> ---------------------------------------------------------------------------------------------------
>
> I plan to use notation later. I'm doing a proof of concept - know the
> fretboard notes as accurately as I know the piano keyboard (just note
> names), then learn the notation for each fret.
>
> Check this out. Go to the end of the thread for the "edspyhill" post for
> an example.
>
> http://www.thestompbox.net/forum/showthread.php?11945-Fretboard-navigation-by-scale-interval-flashcards-just-posted&p=92672...

You need a logon at the stompbox site.

Go here to photobucket.
http://s770.photobucket.com/albums/xx346/edspyhill...

JR

1/1/2016 3:25:00 PM

0

On 01/01/2016 12:18 PM, Stefan Ram wrote:
> The MDN documentation for »document.open« shows it with no
> arguments:
>
> document.open()

I think that was the old DOM Level 2 HTML Specification for the open()
method of the HTMLDocument interface:
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-72...

>
> . But some other web pages give optional arguments:
>
> document.open( MIMEtype, replace )

That is according to the HTML5 specification:

document = document.open( [ type [, replace ] ] )

For more details, see there:
<http://www.w3.org/TR/html5/webappapis.html#dom-documen...


>
> . But this does not seem to work with Mozilla Firefox 38.
> OTOH, it does also not simply ignore the first argument.
>
> Inserting the following code into the JavaScript console
> of Mozilla Firefox 38 shows the page as intended. Note the
> MIME type »text/html«:
>
> document.open( "text/html", "replace" );
> document.writeln
> ( '<!DOCTYPE HTML>'+
> '<html lang="en">\r\n'+
> '<head><meta charset="UTF-8"><title>Main</title><head><style type="text/css">\r\n'+
> '</style></head></head><body>\r\n'+
> ' <p>hello, world</p>\r\n'+
> '<pre><code><script type="application/javascript;version=1.8">\r\n'+
> '</script></code></pre></body></html>\r\n' );
> document.close();
>
> . But when the MIME type is changed into »application/xhtml+xml«,
> the document is not rendered as intended:
>
> document.open( "application/xhtml+xml", "replace" );
> document.writeln
> ( '<!DOCTYPE HTML>'+
> '<html xmlns="http://www.w3.org/1999/x... lang="en" xml:lang="en">\r\n'+
> '<head><meta charset="UTF-8"><title>Main</title><head><style type="text/css">\r\n'+
> '</style></head></head><body>\r\n'+
> ' <p>hello, world</p>\r\n'+
> '<pre><code><script type="application/javascript;version=1.8">/*<![CDATA[*/\r\n'+
> '/*]]>*/</script></code></pre></body></html>\r\n' );
> document.close();
>
> . (This is intended to be a polyglot HTML5 document.)
>
> Instead, it here shows the source code, which is the
> argument of the »writeln« in the browser.
>

document = document . open( [ type [, replace ] ] )

"If the type argument is omitted or has the value "text/html", then the
resulting Document has an HTML parser associated with it, which can be
given data to parse using document.write(). Otherwise, all content
passed to document.write() will be parsed as plain text".
<http://www.w3.org/TR/html5/webappapis.html#dom-documen...

See the steps for the write() and writeln() methods too:
<http://www.w3.org/TR/html5/webappapis.html#dom-document...

--
Joao Rodrigues

ram

1/1/2016 3:33:00 PM

0

Joao Rodrigues <groups_jr-1@yahoo.com.br> writes:
>"If the type argument is omitted or has the value "text/html", then the
>resulting Document has an HTML parser associated with it, which can be
>given data to parse using document.write(). Otherwise, all content
>passed to document.write() will be parsed as plain text".
><http://www.w3.org/TR/html5/webappapis.html#dom-documen...

Thank, you! In addition, I have observed in the meantime that my polyglot
XHTML5 document contained several severe errors, which I now have corrected.

FWIW, the corrected document now reads:

<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/x... lang="en" xml:lang="en">
<head><meta charset="UTF-8" /><title>Hello</title><style type="text/css">
</style></head><body>
<p>hello, world</p>
<pre><code><script type="application/javascript;version=1.8">/*<![CDATA[*/
/*]]>*/</script></code></pre></body></html>

.