As I understand it, the trial court dismissed this action on a FRCP 12 (b) (6) motion to dismiss for failure to state a claim. The legal standard for such a motion to dismiss is that the pleadings UNDER ANY STATE OF FACTS PROVED fail to state a claim for which ANY legal relief may be granted.
In other words, this lawsuit was at the initial stage, when no witnesses have been examined, no discovery has been conducted, and the only issue before the trial court was whether the complaint, under any POSSIBLE state of facts, stated a recognizable claim. So we can't fault the court for failing to investigate the facts. Not time for that yet.
But of course the Ninth Circuit, with its usual lack of common sense and decorum, went WAY beyond the ruling required on appeal of a motion to dismiss for failure to state a claim. The proper course would have been to reverse and remand without all the statements holding the Pledge unconstitutional. But naturally they never miss an opportunity to make themselves obnoxious to the rest of us.