Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #33758

Re: why the ! operator can be used to determine a string is null?

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: why the ! operator can be used to determine a string is null?
Date 2017-08-10 14:51 +0200
Organization PointedEars Software (PES)
Message-ID <e9b36921-388f-976d-2d08-ea3cc91e66ec@PointedEars.de> (permalink)
References (1 earlier) <1939054.irdbgypaU6@PointedEars.de> <e3a5d53f-250f-41b9-83a4-792d3c042966@googlegroups.com> <omedf0$3i$1@csiph.com> <11859138.uLZWGnKmhe@PointedEars.de> <omh0u2$1quk$1@csiph.com>

Show all headers | View raw


Cezary Tomczyk wrote:

> On 09/08/2017 11:32, Thomas 'PointedEars' Lahn wrote:
>> The caveat here is that the first quoted section, being part of
>> section “4 Overview”, which is not normative, and examples in general,
>> are *not normative*.  *Many people misunderstand this* when referring
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> to technical specifications, and ECMAScript in particular.
>> 
>> The *ECMAScript Language* Specification does _not_ specify the
>> features of the “HTML document object model”; the _“HTML document
>> object model” specification_, whatever that is and applies to a runtime
>> environment, does (currently, it would be the HTML 5.1 DOM interfaces,
>> and DOM4, for recent versions of Web browsers).
> 
> My understanding was based on:
> 
>>> | document object model the `window` property of the global object
>>> is | the global object itself.

Yes, I figured.

> That's why I was using:
> 
> (function(global){
> 
> }(this));
> 
> because this in above will always point to the window object.
> 
> https://developer.mozilla.org/en-US/docs/Glossary/Global_object
> 
> "In a web browser, any code which the script doesn't specifically start 
> up as a background task has a Window as its global object. This is the 
> vast majority of JavaScript code on the Web."

Never accept claims at face value.

>> 2. The method has been supported on window objects since the beginning
>>  (Netscape Navigator 2.0).  Why feature-test it *in the same window* to
>>  begin with?
>> 
>> <http://e-pla.net/documents/manuals/javascript-1.0/ref_a-c.html#close_window_method>
>>
>>  3. Why not simply
>> 
>> window.close();
>> 
>> ?
> 
> Why not. Some of the methods exists since the beginning. How do you 
> decide when not to use isHostMethod?

As a rule of thumb, if the object in question always had the method and it
always worked, I do not feature-test it.  Probably I have not been
consistent regarding this as I do not have a suitable DOM Support Matrix
yet, and am checking that on a case-by-case basis.

>> As for the formatting of the article, I suggest that you do not let 
>> code lines to be word-wrapped (for me, there are code lines in your 
>> article that contain only one character from the previous original 
>> line).  Not using `word-wrap`, and using `overflow-x: auto` instead, 
>> enables that; a small `padding-right` value should preserve the 
>> aesthetics, considering the background color.
>> […]
> 
> I've removed `word-wrap` and added `overflow-x: auto`. It should looks 
> better now.

ACK, it does.  Maybe if you use less characters per line (e.g., reduce the
indentation two two spaces) or use a slightly smaller font-size, it looks
even better :)

Please trim your quotes to the relevant minimum next time.

.
.
.
.
.
.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

why the ! operator can be used to determine a string is null? Xue Feng <xf.lotus@yahoo.com> - 2017-08-08 23:43 +0800
  Re: why the ! operator can be used to determine a string is null? Robert Heller <heller@deepsoft.com> - 2017-08-08 11:16 -0500
  Re: why the ! operator can be used to determine a string is null? Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-08-08 17:40 +0000
    Re: why the ! operator can be used to determine a string is null? Julio Di Egidio <julio@diegidio.name> - 2017-08-08 21:38 -0700
      Re: why the ! operator can be used to determine a string is null? John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-09 14:51 +0100
    Re: why the ! operator can be used to determine a string is null? Jon Ribbens <jon+usenet@unequivocal.eu> - 2017-08-09 11:01 +0000
      Re: why the ! operator can be used to determine a string is null? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-09 16:17 +0200
        Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-09 16:14 +0100
          Re: why the ! operator can be used to determine a string is null? Julio Di Egidio <julio@diegidio.name> - 2017-08-09 10:25 -0700
            Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-09 21:04 +0100
              Re: why the ! operator can be used to determine a string is null? Julio Di Egidio <julio@diegidio.name> - 2017-08-09 13:11 -0700
                Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-10 00:59 +0100
                [ANN] Spam filter for Google Groups (was: why the ! operator can be used to determine a string is null?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-10 05:06 +0200
                Re: [ANN] Spam filter for Google Groups (was: why the ! operator can be used to determine a string is null?) Julio Di Egidio <julio@diegidio.name> - 2017-08-10 01:00 -0700
                Re: [ANN] Spam filter for Google Groups (was: why the ! operator can be used to determine a string is null?) John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-10 09:40 +0100
                Re: why the ! operator can be used to determine a string is null? Julio Di Egidio <julio@diegidio.name> - 2017-08-10 00:56 -0700
          Re: why the ! operator can be used to determine a string is null? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-09 22:01 +0200
            Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-09 23:35 +0100
              Re: why the ! operator can be used to determine a string is null? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-10 10:05 +0200
                Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-10 15:08 +0100
                Re: why the ! operator can be used to determine a string is null? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-10 16:42 +0200
          Re: why the ! operator can be used to determine a string is null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-09 23:56 +0200
            Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-10 01:40 +0100
              Re: why the ! operator can be used to determine a string is null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-10 03:44 +0200
                Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-10 03:20 +0100
                Re: why the ! operator can be used to determine a string is null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-10 04:33 +0200
                Re: why the ! operator can be used to determine a string is null? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-08-10 03:57 +0100
  Re: why the ! operator can be used to determine a string is null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-08 23:20 +0200
    Re: why the ! operator can be used to determine a string is null? Julio Di Egidio <julio@diegidio.name> - 2017-08-08 21:20 -0700
      Re: why the ! operator can be used to determine a string is null? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-08-09 09:26 +0200
        Re: why the ! operator can be used to determine a string is null? Julio Di Egidio <julio@diegidio.name> - 2017-08-09 01:31 -0700
        Re: why the ! operator can be used to determine a string is null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-09 11:32 +0200
          Re: why the ! operator can be used to determine a string is null? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-08-10 09:10 +0200
            Re: why the ! operator can be used to determine a string is null? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-10 14:51 +0200
              Re: why the ! operator can be used to determine a string is null? Tim Streater <timstreater@greenbee.net> - 2017-08-10 15:11 +0100
              Re: why the ! operator can be used to determine a string is null? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2017-08-10 18:52 +0200

csiph-web