U.S. stocks rose Wednesday as investors bet that technology companies and small, domestically focused firms will continue to do well even if the trade dispute between the U.S. and China gets worse. Media companies jumped after Disney reached a new deal with Twenty-First Century Fox.

Facebook, Microsoft and Alphabet led the rally in technology companies as the Nasdaq composite topped the all-time high it set last week.

The S&P 500 index rose 4.73 points, or 0.2 percent, to 2,767.32. The Nasdaq composite gained 55.93 points, or 0.7 percent, to 7,781.51. The Russell 2000 index of smaller-company stocks added 13.54 points, or 0.8 percent, to 1,706.99, also closing at a record high. But the Dow industrials slipped 42.41 points, or 0.2 percent, to 24,657.80. The Dow has fallen for seven days in a row, its worst streak in more than a year, although the losses have been fairly small.

U.S. crude oil rose 1.8 percent to $66.22 and Brent crude, the international standard for oil prices, lost 0.5 percent to $74.74 a barrel in London.