News for hackers. Stuff that matters.
Re:Safari releases are development hell by alex-moon on Monday April 03, 2023 @08:37AM (#35422459)
In the job I'm currently in (doing front-end for the first time in many years) I can confidently say that every time we've had a bug that was browser-specific, that browser was some brand of Safari - usually Safari mobile, which shits me even more because the iPhone doesn't let users install any alternatives, i.e. literally what Microsoft went to court for. Reason enough on its own not to get an iPhone, or indeed any Apple product at all. I can only imagine how much Safari has cost the industry in wasted dev time.
Re:Safari releases are development hell by realusername on Monday April 03, 2023 @08:59AM (#35422750)
Sometimes you can even tell it just from the sentry error text itself that it's a safari bug.

It has a kind of distinctive feel of nonsense, I don't know how to explain it.

Re:Safari releases are development hell by vlovich123 on Monday April 03, 2023 @09:40AM (#35423375)
Microsoft went to court over that because they were leveraging their OS monopoly into a browser monopoly. Microsoft always let you install alternatives by the waybut IE was the default and most people don’t change defaults.

Apple is not a monopoly unless you’re just looking at mobile profits, which historically is not how a monopoly is defined (they’re not even a monopoly in the luxury smartphone market). Android is actually much closer to being a monopoly and does all sorts of deals to maintain their monopolies on search, browsers, and Android which would warrant investigation. Now maybe a monopoly should be defined as % of total profits in a market? Not sure. It would be breaking new regulatory ground for sure.

Also, from the sounds of it, Apple is going to be forced to allow third party browsers and app stores via EU regulation. It’s less clear exactly how that will work and whether that will be available to customers in other jurisdictions.

Re:Safari releases are development hell by scarface74 on Monday April 03, 2023 @12:19PM (#35426506)
I knew this bit of false internet lore was going to come up.

Out of all the things that the justice system was throwing at MS, bundling IE was the least of them and absolutely nothing changed about browser bundling in the US. No there was never a browser choice mandate.

Re:Safari releases are development hell by vlovich123 on Monday April 03, 2023 @04:28PM (#35430796)
That’s true. The main focus was on forcing OEMs to bundle Windows for kickbacks. The browser stuff came out of the EU.
Re:Safari releases are development hell by scarface74 on Monday April 03, 2023 @05:01PM (#35431222)
As is true with most laws involving tech and the EU.

https://arstechnica.com/information-technology/2014/12/windo...

> While there were early signs that the browser ballot screen was influencing browser usage in the EU, with Mozilla attributing some European Firefox growth to the selection page, long-term trends strongly suggest that it was next to useless. In spite of equally prominent placement on the selection screen, Opera's share even within Europe appears to have declined over the last five years. So too have Firefox and Internet Explorer. Chrome, however, has experienced significant growth.

Re:Safari releases are development hell by 411111111111111 on Monday April 03, 2023 @02:52PM (#35429339)
> Android is actually much closer to being a monopoly

Thats only true outside of the US though. iOS is >60% in the USA.

Re:Safari releases are development hell by vlovich123 on Monday April 03, 2023 @04:29PM (#35430816)
Not sure where that number comes from. [1] indicates Apple broke 50% for the first time ever in Q3 2022. I doubt they’ve pole vaulted to 60% the past few quarters.

[1] https://9to5mac.com/2022/09/02/iphone-us-market-share/

Re:Safari releases are development hell by cxr on Monday April 03, 2023 @10:29AM (#35424171)
I've run into a pretty ridiculous Chrome bug:

  let f = document.createDocumentFragment();
  f.appendChild(document.createElement("div"));
  f.firstChild.outerHTML = (`<a href="https://bugs.chromium.org/"></a>`);
Fails because a fragment "is not an element node", a completely bogus error. No idea if it fails in Safari, too, since I don't have a Mac anymore, but I'd guess so, since this reeks of the type of corner-cutting that WebKit was guilty of while swimming in accolades for being a fast, standards-compliant browser engine (in contrast to e.g. Gecko).
Re:Safari releases are development hell by lapcat on Monday April 03, 2023 @10:49AM (#35424557)
> a completely bogus error

How is it bogus? outerHTML is an attribute of Element https://developer.mozilla.org/en-US/docs/Web/API/Element/out... and DocumentFragment is not an Element https://developer.mozilla.org/en-US/docs/Web/API/DocumentFra...

> No idea if it fails in Safari, too

It does.

Have you considered that it's just a Gecko quirk that it happens to work in Firefox? Where do the standards say it ought to work?

Re:Safari releases are development hell by cxr on Monday April 03, 2023 @11:40AM (#35425642)
* * *
Re:Safari releases are development hell by lapcat on Monday April 03, 2023 @12:53PM (#35427202)
See the Notes section of the docs: "If the element has no parent element, setting its outerHTML property will not change it or its descendants. Many browsers will also throw an exception." https://developer.mozilla.org/en-US/docs/Web/API/Element/out...

The div has a parent node but no parent element, because a document fragment is not an element.

Re:Safari releases are development hell by LegionMammal978 on Monday April 03, 2023 @12:57PM (#35427283)
The standard says that if the parent node is a DocumentFragment, then a temporary Element must be created to act as the context element for fragment parsing [0].

[0] https://www.w3.org/TR/2016/WD-DOM-Parsing-20160517/#widl-Ele...

Re:Safari releases are development hell by lapcat on Monday April 03, 2023 @01:13PM (#35427579)
Well, if Mozilla's own web developer API documentation contradicts the spec here, then I'd say that none of the browser vendors are doing on good job on this particular issue.
Re:Safari releases are development hell by cxr on Monday April 03, 2023 @02:36PM (#35429078)
* * *
Re:Safari releases are development hell by LegionMammal978 on Monday April 03, 2023 @03:05PM (#35429568)
That's not quite what it says; it says that (unconditionally) it will do nothing without a parent element and (conditionally, depending on the browser) it will throw an exception. The first part is inaccurate, since the standard behavior (which is the current behavior of Gecko and the intended behavior of Blink) is to let it work naturally on children of DocumentFragments. It should probably be updated to clarify this, but I wouldn't see the remark as very "normative" in the first place.
Re:Safari releases are development hell by cxr on Tuesday April 04, 2023 @09:44AM (#35439479)
What?
Re:Safari releases are development hell by LegionMammal978 on Wednesday April 05, 2023 @10:09AM (#35454515)
I just don't see how you interpreted the remark in the way you did. Regardless, I've filed a PR to make the docs clearer [0] so neither of us has to waste any more time on this.

[0] https://github.com/mdn/content/pull/25925

Re:Safari releases are development hell by cxr on Wednesday April 05, 2023 @11:29AM (#35455831)
> I just don't see how you interpreted the remark in the way you did

Can you be concrete? (This reply doesn't really clear up anything about the previous comment.)

Re:Safari releases are development hell by LegionMammal978 on Wednesday April 05, 2023 @12:02PM (#35456340)
Well, it literally says, "If the element has no parent element, setting its outerHTML property will not change it or its descendants. Many browsers will also throw an exception." I interpret this as, "If the element has no parent element, setting its outerHTML property will not change it or its descendants. Many browsers will throw an exception [on setting an element's outerHTML property if it has no parent element]."

This contains two independent statements, (a) "If the element has no parent element, setting its outerHTML property will not change it or its descendants," and (b) "Many browsers will also throw an exception [on setting an element's outerHTML property if it has no parent element]."

Statement (b) is true, since Chromium- and WebKit-based browsers will throw an exception if the element doesn't have a parent node which is also an element. Statement (a) isn't browser-specific, and thus it is false, since on Firefox, setting an element's outerHTML will change it and its descendants if its parent node is a document fragment (which is not a parent element).

Where we differ might be that I don't see the "many browsers" qualification as applying to the first statement.

Re:Safari releases are development hell by LegionMammal978 on Monday April 03, 2023 @02:40PM (#35429145)
To be fair, the Exceptions section on that page gives the correct criterion:

> NoModificationAllowedError DOMException

> Thrown if an attempt was made to set outerHTML on an element which is a direct child of a Document, such as Document.documentElement.

So I'd say the Notes section is simply imprecise.

Re:Safari releases are development hell by LegionMammal978 on Monday April 03, 2023 @12:55PM (#35427237)
> Where do the standards say it ought to work?

The wording has not changed since the 2016 version of the DOM Parsing and Serialization standard [0]:

> On setting, the following steps must be run: 1. Let parent be the context object's parent. [...] 4. If parent is a DocumentFragment, let parent be a new Element with

> - body as its local name,

> - The HTML namespace as its namespace, and

> - The context object's node document as its node document.

But Blink instead throws a DOMException with name "NoModificationAllowedError" and message "Failed to set the 'outerHTML' property on 'Element': This element's parent is of type '#document-fragment', which is not an element node." This was filed as a Chromium bug last December and assigned a week later [1].

[0] https://www.w3.org/TR/2016/WD-DOM-Parsing-20160517/#widl-Ele...

[1] https://crbug.com/1403060

Re:Safari releases are development hell by kingboss on Monday April 03, 2023 @12:29PM (#35426730)
Laughable take. When there was only IE6 people complained. Now that there is more than one people complain that they have to test their stuff more and wish to go back to one browser to rule them all. You don't like testing? How hard can it be to test on the top 3-4 browsers? Maybe it's not wasted dev time, it's called work? Maybe software industry isn't for you... Sidenote: Why so many snowflakes on HN? Too much entitlement or is it the easy money? In what job is it considered acceptable to not test on half the devices in the world?